We are studying the use of the canaries to avoid buffer overflow.
There is a question that is:
Why aren’t canaries useful in this struct?
struct test {
char arra[64];
int myVar;
}
and I’m stuck on it. Any clue?
Pd. This is homework
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
I believe your professor means it will not protect (for sure) from overflow of the array within your structure. The compiler places the canary value somewhere between your structure and the end of the stack. If you overflow your array by less than int bytes, the overflow corrupts the int element of your structure, not the canary value (this is not precise because of compiler chosen structure layout). So in such cases an overflow goes undetected and could be exploited.