Я пытаюсь реализовать самые основы переполнения буфера, ничего противозаконного. Насколько я понимаю приведенный ниже код, в переполненном буфере недостаточно места для всех записываемых данных, а это означает, что он запишет их в p1 (p1 начало — 32 бита? от конца переполнения). Однако я не могу заставить его работать и не знаю почему.
#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
Подробнее здесь: https://stackoverflow.com/questions/797 ... chool-in-c