我有C程序的问题:
char *str = (char *) malloc(20);
strcpy_s(str, 10, "abcdefghij");
//here I change one byte before str and one byte after
*((int*)str-1) = 10;
*((int*)(str+20)) = 10;
//and it stops on the..
free(str);
Run Code Online (Sandbox Code Playgroud)
在调试过程中出错了什么?
覆盖未分配内存的部分是任务的一部分.我知道通常它不正确,但在这种情况下它是任务的一部分.
| 归档时间: |
|
| 查看次数: |
174 次 |
| 最近记录: |