Thanks Phillip!
I think we are getting somewhere. Here is the modified snippet:
hlp[299]=0;
strncpy(hlp,optarg,299);
printf("hlp :%p-\n", hlp);
printf("hlp :%s-\n", hlp);
hlp2=strtok(hlp,":");
printf("hlp :%p-\n", hlp);
printf("hlp :%s-\n", hlp);
printf("hlp2 :%p-\n", hlp2);
printf("hlp2 :%s-\n", hlp2);
IP[255]=0;
strncpy(IP,hlp,255);
And here the result for sudo sniffit -t192.1.100.1:
hlp :0x7fff9c7e1bb0-
hlp :192.1.100.1-
hlp :0x7fff9c7e1bb0-
hlp :192.1.100.1-
hlp2 :0xffffffff9c7e1bb0-
Segmentation fault
So, indeed the two pointers are not the same.
Do you understand why hlp2 is 64 bytes long (is it a logical address?).
Do you understand why the high byte of hlp2 when truncated to 48 bytes is f
(not 7)?
Still, it doesn't look like this is an app bug, but a libc or gcc bug?
--
Segmentation Fault
https://bugs.launchpad.net/bugs/107180
You received this bug notification because you are a member of Ubuntu
Bugs, which is the bug contact for Ubuntu.
--
ubuntu-bugs mailing list
[email protected]
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs