The functions intlen, len, and iptoa provide a very convoluted way to compute the number of decimal

Question:

The functions intlen, len, and iptoa provide a very convoluted way to compute the number of decimal digits required to represent an integer. We will use this as a way to study some aspects of the gcc stack protector facility.

int len(char *s) { return strlen(s); } void iptoa (char *s, long *p) { long val *p; sprintf (s,

The following show portions of the code for intlen, compiled both with and without stack protector:

(a) Without protector

1 2 3  4 5 6 1 2 3 4 5 6 7 (b) With protector 00 int intlen (long x) x in %rdi intlen: subq movg 8 9 leaq

A. For both versions: What are the positions in the stack frame for buf, v, and (when present) the canary value?

B. How does the rearranged ordering of the local variables in the protected code provide greater security against a buffer overrun attack?

Fantastic news! We've Found the answer you've been seeking!

Step by Step Answer:

Related Book For  book-img-for-question

Computer Systems A Programmers Perspective

ISBN: 9781292101767

3rd Global Edition

Authors: Randal E. Bryant, David R. O'Hallaron

Question Posted: