Question: The following code is similar to the code shown in Practice problem 3.48 of page 288. #include #include #include #include int len(char *s) { return

The following code is similar to the code shown in Practice problem 3.48 of page 288.

#include  #include  #include  #include  int len(char *s) { return strlen(s); } void lptoa(char *s, long *p) { long val = *p; sprintf(s,"%ld",val); } long longlen(long x) { long v; char buf[8]; v = x; lptoa(buf,&v); return len(buf); } int main() { longlen(INT_MAX-1); } 

Compile the code with and without stack protector.

Fill the table with appropriate values. Leave the entries empty if not applicable.

no stack protector stack protector
gcc flag
len assembly for allocating stack
stack size in decimal
assembly for freeing stack
lptoa assembly for allocating stack
stack size in decimal
assembly for freeing stack
"char *s" address relative to rsp after entering lptoa
"long *p" address relative to rsp after entering lptoa
"val" address relative to rsp after entering lptoa
longlen assembly for allocating stack
stack size in decimal
assembly for freeing stack
"x" address relative to rsp after entering longlen
"v" address relative to rsp after entering longlen
"buf" address relative to rsp after entering longlen
canary register name
canary address relative to rsp
canary value
assembly for erasing canary value
assembly for canary cross check

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!