[PLUG] stack smash issue

abhi abhi.elementx at gmail.com
Fri Jul 31 17:05:56 IST 2009

Hello all.
 I m trying to smash(change the return address) the stack.

I think i m missing the correct numbers(sue to differences in krnl and gcc
Heres the code :

void function(int a, int b, int c) {
char buffer1[5];
char buffer2[10];
int *ret;

ret = buffer1 + 9;//I think that ret address is 5 bytes away...
(*ret) += 7;//diff between actual ret address and target

int main() {
int x;
x = 0;
x = 1;//shud skip this
printf("%d\n",x);//shud print 0
return 0;

The program prints 1 when it shud print 0.

I m using ubuntu 9.04 kernel 2.6.28-14-generic and gcc version 4.3.3 (Ubuntu

Cud someone tell me how to find the  size of the arrays, variables on stack
from the assembly code?

Thank u.

More information about the Plug-mail mailing list