fortify-headers

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

test_strlcpy_static_write.c (337B)


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