Question: Consider the functions below, with both C code and compiled assembly provided. Recall that gets ( buf ) simply copies input in to buf. The
Consider the functions below, with both C code and compiled assembly provided. Recall that getsbuf simply copies input in to buf. The inintial values of rsp rbp and rip are provided. The initial value of rip tells you the first instruction which will start to execute: the push at the start of testfunc. You can assume that the leaveq instruction is equivalent to movq $rbp $rsp followed by popq $rbp
a What is the fewest number of characters you could enter to gets, that would cause this program to behave anomalously ie to experience buffer overflow
Remember, gets will always add a nul character immediately after the last character you enter, to mark the end of the string.
b Suppose the program executes until rip is ; immediately before the call to gets. What is the hexadecimalformatted fourbyte value at
c What is the fewest number of characters you could enter to gets, that would cause this program to execute anomalous instructions ie set rip to a value it
would not otherwise have Remember, gets will always add a null character immediately after the last character you enter, to mark the end of the string.
d Suppose you want to construct an input to make this program print as is done by the magic function. The input below includes the null
character gets will add, and is nearly complete; fill in the single blank character.
e Suppose you want to construct an input to make this program print excedeface, instead of exaddedfee. The input below includes the null character gets will
add, and is nearly complete; fill in the single blank character. Remember, rbp is the base of a function's stack frame.
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
