fortify-headers

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

test_strlen_static_read.c (353B)


      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   char* canary1 = "ABCDEFGHIJKLMNOPQ";
     10   char buf[] = {'a', 'b', 'c', 'd', '\0'};
     11   char* canary2 = "ABCDEF";
     12   strlen(buf);
     13   puts(buf);
     14   buf[4] = 'e';
     15 
     16   CHK_FAIL_START
     17   strlen(buf);
     18   CHK_FAIL_END
     19 
     20   puts(argv[1]);
     21   return ret;
     22 }