1 // commit cef0f289f666b6c963bfd11537a6d80916ff889e 2014-06-19 2 // memmem should not access oob data 3 #ifndef _GNU_SOURCE 4 #define _GNU_SOURCE 5 #endif 6 #include <string.h> 7 #include "test.h" 8 main(void)9int main(void) 10 { 11 const unsigned char haystack[] = { 0,0,0,0,0,0,0,1,2 }; 12 const unsigned char needle[] = { 0,0,0,0,0,0,0,1,3 }; 13 unsigned char *p = memmem(haystack, 8, needle, 8); 14 if (!p) 15 t_error("memmem(A,8,A,8) returned 0, want A\n"); 16 return t_status; 17 } 18