fortify-headers

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

test_memchr_dynamic_read.c (310B)


      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   memchr(buffer, (int)'4', strlen(buffer) - 1);
      9   puts(buffer);
     10 
     11   CHK_FAIL_START
     12   memchr(buffer, (int)'A', argc);
     13   CHK_FAIL_END
     14 
     15   puts(buffer);
     16 #endif
     17   return ret;
     18 }