Code: Select all
p1Code: Select all
#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
Mobile version