On Thu, Oct 09, 2014 at 01:54:57PM +0800, Rongqing Li wrote:
> The attachment is a piece of C code.
> When compile it with -O2 option, a segfault occurs:
>
> strncpy(new, old, cp-old);
It is a bug of course, but in the testcase.
Calling strncpy with NULL second argument, even when the size
The attachment is a piece of C code.
When compile it with -O2 option, a segfault occurs:
##
root@qemux86-64:~# gcc -o test test.c
root@qemux86-64:~# ./test
192.168.1.1
root@qemux86-64:~#
root@qemux86-64:~# gcc -O2 -o test test.c
root@qemux86-64:~# ./test
test[893]: segfault at 0 ip