So I tried debugging some simple C programs today ;
First one being
int main(){
int a ,b ;
return 0 ;
}
Which when de-compiled gave me
push ebp
mov ebp,esp
sub esp,008h
because I need to have 8 bytes to store a and b in the current stack frame since they are local variable !
But when I try the same with Strings say
int main() {
char greeting[12] = "Pwnit2Ownit";
return 0;
}
Which when de-compiled gave me
push ebp
mov ebp,esp
sub esp,0DCh
0DCh is 220 , But since the string is only 12 bytes long shouldn't the
sub esp,0DCh
be
sub esp,00ch
instead ?
And can anyone share some links on how the strings are stored in the memory and accessed later via assembly [preferebly instruction] , like hows the string greetings stored in memory if it's length is large since we can't store all in the stack itself