Код: Выделить всё
p1Код: Выделить всё
#include
#include
#include
#include
int main() {
//create two pieces of stack memory - p1 first and then overflowing below it,
//so that overflow can overflow into p1
char* p1 = (char*)malloc(32 * sizeof(char));
char* overflowing = (char*)malloc(32 * sizeof(char));
//get the end location of p1
auto temp = p1;
for (int i = 0; i < 32; i++) { temp++; }
//see the memory locations of p1, end of p1, and overflow memory start
std::cout
Подробнее здесь: [url]https://stackoverflow.com/questions/79796604/trying-to-create-buffer-overflow-for-an-example-for-school-in-c[/url]
Мобильная версия