I’m trying to overflow a buffer in C++ that is a private variable. Where does it live on the stack? Is this possible?
Something like
class aClass{
private:
char buffer[SIZE];
public:
}
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.
Er… Your question sounds like “What color is blue sky?”. And the answer is, apparently, “blue”.
When a variable is allocated “on the stack” it lives on the stack. There’s no more detailed explanation to it. “On the stack” is the answer to “where?” question. Stack memory is uniform. There’s no more detailed “where” than plain and simple “on the stack”.
The fact that your array is a private member of the class makes no difference whatsoever. The entire array is an integral part of the object. If you define an object of your class type as a local object (“on the stack”), then the entire array will live on the stack, regardless of whether it is private or not.
If that doesn’t answer your question, ten you have to re-state it in a more meaningful way.