Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我的简化代码如下所示:
char decrypted[64] = "P@ssw0rd "; int realsize = 8; realloc(decrypted, realsize); char *dec2 = (char *) malloc(realsize+1); // Exe crashes at this point
我猜它与char *dec2 有关 ,但这只会因某种原因导致 Win XP 崩溃。
您不能使用or或realloc()未分配的内容。malloc()calloc()realloc()
realloc()
malloc()
calloc()
decrypted是分配在堆栈上的数组。realloc只能用malloc或重新分配在堆上分配的内存calloc。
decrypted
realloc
malloc
calloc