segmentation fault

Oliver Block
2006-11-11T01:23:51Z

Hello,

a program causes a segmentation fault and I'd like to know if I interpret the
following gdb output correctly (text continues after output):
************************************************************************************
#1 Â 0x4012eb3f in gethostbyname () from /lib/tls/libc.so.6
No symbol table info available.
#2 Â 0x08049312 in http_send_recv (hostname=0x804a340 "www.oliver-block.eu",
Â  Â  request=0x804b030 "GET /checkip.php HTTP/1.0\r\nHost:
www.oliver-block.eu\r\n\r\n") at ddnscli.c:168
Â  Â  Â  Â  hptr = (struct hostent *) 0x804b068
Â  Â  Â  Â  sptr = (struct servent *) 0x804b028
Â  Â  Â  Â  sin = {sin_family = 2, sin_port = 0, sin_addr = {s_addr = 0},
Â  sin_zero = "\000\000\000\000\000\000\000"}
Â  Â  Â  Â  s = 134514323
Â  Â  Â  Â  retval = 45
Â  Â  Â  Â  n = 0
Â  Â  Â  Â  buflen = 1024
#3 Â 0x080498ee in get_ip (qry=0x804b008) at ddnscli.c:323
Â  Â  Â  Â  tmp = 0x0
Â  Â  Â  Â  r = 0x804b030 "GET /checkip.php HTTP/1.0\r\nHost:
www.oliver-block.eu\r\n\r\n"
#4 Â 0x080499fa in main (argc=3, argv=0xbffff1a4) at ddnscli.c:398
Â  Â  Â  Â  option = 8 '\b'
Â  Â  Â  Â  q = (struct query *) 0x804b008
(gdb) p sizeof(struct servent)
$1 = 16
****************************************************************************
When I extract

from #2:
sptr = (struct servent *) 0x804b028

from #4:
r = 0x804b030 "GET /checkip.php HTTP/1.0\r\nHost: www.oliver-block.eu\r\n\r\n"

as servent has a size of 16 bytes

804b028 + 16 = 0x804b038

These two variables seem to overlap. Do you agree?

Regards,

Oliver
--
Leben ist mehr als ...
<http://www.nak-nrw.de/index.php?id=71>