In our Format String Vulnerability Lab, we modified the security with our new ke
ID: 3811205 • Letter: I
Question
In our Format String Vulnerability Lab, we modified the security with our new key, i.e., Write the print statement to modify the key with a new value 100. Describe your steps format string attack. Assume all lab settings are the same and we know one of our position. The following contains statement violate spatial safety policy. Explain the policy using the triples (p, b, c), where p is the actual pointer h is the base of the memory region it may access e is the extent (bounds) of that region Int x;//assume sizeof(int)=4! int *y = &x; int *z = y+2; *y = 3; *z = 3;Explanation / Answer
Answer:
Pointer can hold a special kind of value which is memory address of something. In this case int x is a variable that stores in a memory location .Now int *y=&x; is correct statement because *y can only have & adress of a variable in this case x.
int *z=Y+2, here we are actually saying that whatever at variable y+2, now variable y has the address of x+2 means add 8 byte in the address and that address should be stored in z pointer.
but statement *y=3; and *z=3; will crash the programme because here we are violating . We are actually assigning some values that are not possible to hold by pointers.They are trying to have same address which is not possible OS will crash the programme. We are violating memory management rules actually Os crashes our programme Normally we can not assign other integer values to pointers, it can only hold the address .Suppose
int a[4]={1,4,5,6};
int *b=a;
cout <<*(b+1); what will be output?
yes it will be 4.
So pointers can only point to address not a value.
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.