G
gautam
can anyone pls tell me y is the memory allocation not alligned to 4 Bytes.
Note : compiled with gcc in linux 9
void function(int a,int b,int c)
{
char buffer1[5];
Bytes allocated(as shown by gdb)
/*buffer1[4] ---------------------> 4
buffer1[8] ---------------------> 8
buffer1[5|6|7|9...18] ----------> 18
buffer1[19...] -----------------> 28
int *ret;
ret = buffer1+28;
(*ret) += 0xa;
}
int main()
{
int x;
x=0;
function(1,2,3);
x=1;
printf("%d\n",x);
return 0;
}
I was trying the article from phrack 49 (Smashing the stack for fun n
profit) when I noticed this behaviour by gcc.
Is something wrong with gcc or am I missing on some knowledge here....
Thanks in advance.
Note : compiled with gcc in linux 9
void function(int a,int b,int c)
{
char buffer1[5];
Bytes allocated(as shown by gdb)
/*buffer1[4] ---------------------> 4
buffer1[8] ---------------------> 8
buffer1[5|6|7|9...18] ----------> 18
buffer1[19...] -----------------> 28
int *ret;
ret = buffer1+28;
(*ret) += 0xa;
}
int main()
{
int x;
x=0;
function(1,2,3);
x=1;
printf("%d\n",x);
return 0;
}
I was trying the article from phrack 49 (Smashing the stack for fun n
profit) when I noticed this behaviour by gcc.
Is something wrong with gcc or am I missing on some knowledge here....
Thanks in advance.