I'm actually busy with learning more about buffer overflows. I read some interesting tutorials and just got the basic idea behind it. I tried to produce a vulnerable c++ file to test my knowledge against it, but it seems like I missed some of the concepts...
My code is the following:
#include <iostream>
/* run this program using the console, or add your own getch, system("pause"), or input loop */
int main(int argc, char** argv) {
char xx[20];
char yy[20];
std::cin >> xx;
std::cout << xx << std::endl;
std::cout << yy << std::endl;
}
In my opinion I should be able to write with a 21 Char-Long String in "xx" over the data in "yy". But "yy" is still full with some random chars ('cause no initialization) and not with the overflowing content of the variable "yy".
Could you tell me why this is happening?
Thanks in advance!