fortify-headers

standalone fortify-source implementation
git clone git://git.2f30.org/fortify-headers
Log | Files | Refs | README | LICENSE

test_mempcpy_static_read.c (279B)


      1 #include "common.h"
      2 
      3 #define _GNU_SOURCE
      4 #include <string.h>
      5 
      6 int main(int argc, char** argv) {
      7   char buffer[8] = {0};
      8   mempcpy(buffer, "123456", 4);
      9   puts(buffer);
     10 
     11   CHK_FAIL_START
     12   mempcpy(buffer, "123456", sizeof(buffer));
     13   CHK_FAIL_END
     14 
     15   puts(buffer);
     16   return ret;
     17 }