Trouble with getbyhostname()

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • sam.barker0@gmail.com

    Trouble with getbyhostname()


    Hi,
    I am having trouble with getbyhostname() .I works sometimes but on
    other occasions it crashes.
    IPADDRESS is a string say "192.123.12 .1"

    (gdb)
    Client::SendSoc ket (this=0xbfa9493 c, QuerBuf=@0xbfa9 48c4,
    IPADDRESS=@0xbf a948d4) at Client.cc:141
    141 h = gethostbyname(I PADDRESS.c_str( ));
    (gdb)
    *** glibc detected *** /home/workspace/DNSResolver1/checkstring:
    free(): invalid next size (normal): 0x0804eb38 ***
    ======= Backtrace: =========
    /lib/tls/i686/cmov/libc.so.6[0xb7db1d65]
    /lib/tls/i686/cmov/libc.so.6(cfree +0x90)[0xb7db5800]
    /lib/tls/i686/cmov/libc.so.6(fclos e+0x134)[0xb7da06f4]
    /lib/tls/i686/cmov/libc.so.6[0xb7e2a73d]
    /lib/tls/i686/cmov/libc.so.6(__res _ninit+0x25)[0xb7e2ae65]
    /lib/tls/i686/cmov/libc.so.6(__res _maybe_init+0x7 b)[0xb7e2c30b]
    /lib/tls/i686/cmov/libc.so.6(__nss _hostname_digit s_dots+0x2d)
    [0xb7e2dcdd]
    /lib/tls/i686/cmov/libc.so.6(getho stbyname+0x9a)[0xb7e3227a]
  • abubakarm@gmail.com

    #2
    Re: Trouble with getbyhostname()

    Hi, i think this a wrong group to post the kind of problem that u r
    looking to solve. You have to find some newsgroup where sockets
    related stuff is discussed.

    Regards,
    ..ab

    On Mar 26, 5:18 pm, sam.bark...@gma il.com wrote:
    Hi,
    I am having trouble with getbyhostname() .I works sometimes but on
    other occasions it crashes.
    IPADDRESS is a string say "192.123.12 .1"
    >
    (gdb)
     Client::SendSoc ket (this=0xbfa9493 c, QuerBuf=@0xbfa9 48c4,
        IPADDRESS=@0xbf a948d4) at Client.cc:141
    141             h = gethostbyname(I PADDRESS.c_str( ));
    (gdb)
    *** glibc detected *** /home/workspace/DNSResolver1/checkstring:
    free(): invalid next size (normal): 0x0804eb38 ***
    ======= Backtrace: =========
    /lib/tls/i686/cmov/libc.so.6[0xb7db1d65]
    /lib/tls/i686/cmov/libc.so.6(cfree +0x90)[0xb7db5800]
    /lib/tls/i686/cmov/libc.so.6(fclos e+0x134)[0xb7da06f4]
    /lib/tls/i686/cmov/libc.so.6[0xb7e2a73d]
    /lib/tls/i686/cmov/libc.so.6(__res _ninit+0x25)[0xb7e2ae65]
    /lib/tls/i686/cmov/libc.so.6(__res _maybe_init+0x7 b)[0xb7e2c30b]
    /lib/tls/i686/cmov/libc.so.6(__nss _hostname_digit s_dots+0x2d)
    [0xb7e2dcdd]
    /lib/tls/i686/cmov/libc.so.6(getho stbyname+0x9a)[0xb7e3227a]

    Comment

    • sam.barker0@gmail.com

      #3
      Re: Trouble with getbyhostname()

      I was thinking that it might not be a networking related issue but a
      memory related issue.I cannot seem to put my figure on it
      After the error.The was a memory map.
      ====== Memory map: ========
      08048000-0804c000 r-xp 00000000 08:06 1619927 /home/workspace/
      backup/DNSResolver1/checkstring
      0804c000-0804d000 rw-p 00003000 08:06 1619927 /home/workspace/
      backup/DNSResolver1/checkstring
      0804d000-0806e000 rw-p 0804d000 00:00 0 [heap]
      b7b00000-b7b21000 rw-p b7b00000 00:00 0
      b7b21000-b7c00000 ---p b7b21000 00:00 0
      b7cbf000-b7cc0000 rw-p b7cbf000 00:00 0
      b7cc0000-b7e04000 r-xp 00000000 08:06 2095711 /lib/tls/i686/cmov/
      libc-2.6.1.so
      b7e04000-b7e05000 r--p 00143000 08:06 2095711 /lib/tls/i686/cmov/
      libc-2.6.1.so
      b7e05000-b7e07000 rw-p 00144000 08:06 2095711 /lib/tls/i686/cmov/
      libc-2.6.1.so
      b7e07000-b7e0a000 rw-p b7e07000 00:00 0
      b7e0a000-b7e14000 r-xp 00000000 08:06 2060358 /lib/libgcc_s.so.1
      b7e14000-b7e15000 rw-p 0000a000 08:06 2060358 /lib/libgcc_s.so.1
      b7e15000-b7e16000 rw-p b7e15000 00:00 0
      b7e16000-b7e39000 r-xp 00000000 08:06 2095715 /lib/tls/i686/cmov/
      libm-2.6.1.so
      b7e39000-b7e3b000 rw-p 00023000 08:06 2095715 /lib/tls/i686/cmov/
      libm-2.6.1.so
      b7e3b000-b7f23000 r-xp 00000000 08:06 1128811 /usr/lib/libstdc++.so.
      6.0.9
      b7f23000-b7f26000 r--p 000e8000 08:06 1128811 /usr/lib/libstdc++.so.
      6.0.9
      b7f26000-b7f28000 rw-p 000eb000 08:06 1128811 /usr/lib/libstdc++.so.
      6.0.9
      b7f28000-b7f2e000 rw-p b7f28000 00:00 0
      b7f3d000-b7f3f000 rw-p b7f3d000 00:00 0
      b7f3f000-b7f59000 r-xp 00000000 08:06 2060373 /lib/ld-2.6.1.so
      b7f59000-b7f5b000 rw-p 00019000 08:06 2060373 /lib/ld-2.6.1.so
      bf985000-bf99b000 rw-p bf985000 00:00 0 [stack]
      ffffe000-fffff000 r-xp 00000000 00:00 0 [vdso]

      Comment

      • dave_mikesell@fastmail.fm

        #4
        Re: Trouble with getbyhostname()

        On Mar 26, 9:29 am, sam.bark...@gma il.com wrote:
        I was thinking that it might not be a networking related issue but a
        memory related issue.I cannot seem to put my figure on it
        Post the smallest piece of code that compiles and exhibits the problem
        and we might be able to help. Memory-related problems occur for a
        variety of reasons.

        Comment

        • Victor Bazarov

          #5
          Re: Trouble with getbyhostname()

          sam.barker0@gma il.com wrote:
          I was thinking that it might not be a networking related issue but a
          memory related issue.I cannot seem to put my figure on it
          After the error.The was a memory map.
          "Put my finger on it". And see FAQ 5.8.

          V
          --
          Please remove capital 'A's when replying by e-mail
          I do not respond to top-posted replies, please don't ask


          Comment

          • sam.barker0@gmail.com

            #6
            Re: Trouble with getbyhostname()

            Solved.There was a buffer overflow in a function call.

            Comment

            Working...