Menu

#48 UDT::getsockname() with can cause segfault

open
nobody
5
2004-07-20
2004-07-20
Joe Love
No

It's possible to make getsockname() produce a segfault
by providing it a socket which is not connected to
anything (but has been created with UDT::socket(...)).
The same is probably true for getpeername(), but has
not been tested as of this writing.

Below is a backtrace from gdb with some information on
the segfault.
(gdb) bt
#0 0x4018c9bf in memcpy () from /lib/libc.so.6
#1 0x4003aa48 in CUDTUnited::getsockname ()
from /home/u2/joelove/lib/libudt.so
#2 0x4003d0f1 in CUDT::getsockname () from
/home/u2/joelove/lib/libudt.so
#3 0x08049c39 in UDT::getsockname (u=1073741822,
name=0xbf3ffac0,
namelen=0xbf3ffad0) at
/automount/u2/joelove/include/udt.h:1778
#4 0x0804936a in clientThread (in=0x0) at simple2.cpp:33
#5 0x4005de51 in pthread_start_thread () from
/lib/libpthread.so.0

Discussion

  • Joe Love

    Joe Love - 2004-07-20
    • summary: UDT::getsockname() with bad socket causes segfault --> UDT::getsockname() with can cause segfault
     
  • Joe Love

    Joe Love - 2004-07-20

    Logged In: YES
    user_id=1078925

    It's also apparently possible to cause it to segfault in
    both getsockname and getpeername when using a socket which
    is not listening, or perhaps it's just that it's implicitely
    bound. In either case, I seem to be able to use getpeername
    perfectly fine in a server program, but not in a client program.

     
  • Yunhong Gu

    Yunhong Gu - 2004-07-21

    Logged In: YES
    user_id=275995

    I forgot to check the connection status. It is fixed now.

     

Log in to post a comment.

MongoDB Logo MongoDB