We respect your privacy. Our website does not use cookies, but some embedded content and external links may collect data. By continuing to use the site, you acknowledge our Privacy Policy.

Single buffer overflow/underflow

int x[10];

x[10] = 5;  ->  Error!!
x[-4] = 3;  ->  Error!!
Single Buffer Overflow [PDF]

Multiple buffer overflow/underflow

int y[10][10][10];

y[10][3][4] = 5;  ->  Error!!
y[3][10][7] = 11;  ->  Error!!
y[3][2][10] = 8;  ->  Error!!
y[-3][6][4] = 5;  ->  Error!!
y[3][-4][9] = 12;  ->  Error!!
and so on...

Struct test

typedef struct test_s {
char a[10];
char b[10];
char c[10][5];
} TEST;

TEST test;
test.a[-1] = 3;  ->  Error!!
test.a[10] = 6;  ->  Error!!
test.b[-2] = 7;  ->  Error!!
test.b[11] = 4;  ->  Error!!
test.c[-2][3] = 7;  ->  Error!!
test.c[10][2] = 4;  ->  Error!!
test.c[0][19] = 4;  ->  Error!!
test.c[8][-1] = 4;  ->  Error!!
and so on...

Null Pointer and pointer test


int *p;
int **pp;
TEST test;
TEST *ptest;
...
p = NULL;
*p = 1;  ->  Error!!
pp = &p;
**pp = 1;  ->  Error!!
ptest = &test;
ptest->c[0][19] = 4;  ->  Error!!
ptest->c[8][-1] = 1;  ->  Error!!
ptest = NULL;
ptest->c[8][0] = 1;  ->  Error!!
and so on...