string test alignment fix by Mahesh Bodapati
[libc-test.git] / src / regression / memmem-oob-read.c
blob0694bfe9be8d89193b3b59230cc556f71baadec9
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"
9 int main(void)
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;