fortify-headers

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

test_mempcpy_static_read.c (310B)


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