Closed smilelc3 closed 1 year ago
#include <malloc.h> #include <string.h> void test() { int *ptr = malloc(sizeof(int) * 10); ptr[10] = 7; // 内存越界 memcpy(ptr + 1, ptr, 5); // 踩内存 free(ptr); free(ptr); int *p1; *p1 = 1; } int main() { test(); return 0; }