Blame src/regression/memmem-oob-read.c
|
Szabolcs Nagy |
b9f7b8 |
// commit cef0f289f666b6c963bfd11537a6d80916ff889e 2014-06-19
|
|
Szabolcs Nagy |
b9f7b8 |
// memmem should not access oob data
|
|
Szabolcs Nagy |
b9f7b8 |
#ifndef _GNU_SOURCE
|
|
Szabolcs Nagy |
b9f7b8 |
#define _GNU_SOURCE
|
|
Szabolcs Nagy |
b9f7b8 |
#endif
|
|
Szabolcs Nagy |
b9f7b8 |
#include <string.h>
|
|
Szabolcs Nagy |
b9f7b8 |
#include "test.h"
|
|
Szabolcs Nagy |
b9f7b8 |
|
|
Szabolcs Nagy |
b9f7b8 |
int main(void)
|
|
Szabolcs Nagy |
b9f7b8 |
{
|
|
Szabolcs Nagy |
b9f7b8 |
const unsigned char haystack[] = { 0,0,0,0,0,0,0,1,2 };
|
|
Szabolcs Nagy |
b9f7b8 |
const unsigned char needle[] = { 0,0,0,0,0,0,0,1,3 };
|
|
Szabolcs Nagy |
b9f7b8 |
unsigned char *p = memmem(haystack, 8, needle, 8);
|
|
Szabolcs Nagy |
b9f7b8 |
if (!p)
|
|
Szabolcs Nagy |
b9f7b8 |
t_error("memmem(A,8,A,8) returned 0, want A\n");
|
|
Szabolcs Nagy |
b9f7b8 |
return t_status;
|
|
Szabolcs Nagy |
b9f7b8 |
}
|