segfault
A segfault occurs when a program attempts to access a memory location that is not allowed to access, or attempts to access a memory location in a way is not allowed.
// segfault.cpp : Defines the entry point for the console application. // #include "stdafx.h" #include <string.h> int _tmain(int argc, _TCHAR* argv[]) { char a[2]; char b[] = "Hello world!"; memcpy(a, b, strlen(b)); return 0; }
上述示例也就是我们常说的越界访问!
作者:
薛定谔の喵
出处:
http://www.cnblogs.com/berlin-sun/
本文版权归作者和博客园共有,欢迎转载,但未经作者同意必须保留此段声明,且在文章页面明显位置给出原文链接,否则保留追究法律责任的权利。
浙公网安备 33010602011771号