fortify-headers

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

test_memchr_static_read.c (366B)


      1 #include "common.h"
      2 
      3 #include <string.h>
      4 
      5 int main(int argc, char** argv) {
      6 #if __STDC_VERSION__ < 201112L
      7   const char* buffer = "12345";
      8   const char* padding = "ABCDEFGHIJKLMN";
      9   memchr(buffer, (int)'4', strlen(buffer) - 1);
     10   puts(buffer);
     11 
     12   CHK_FAIL_START
     13   memchr(buffer, (int)'A', strlen(buffer) + 4);
     14   CHK_FAIL_END
     15 
     16   puts(buffer);
     17 #endif
     18   return ret;
     19 }