Here is a small bug (?) in pth. For example, suppose in a normal UNIX
environment you call the sendto() function with a file descriptor of -1.
The result is that -1 is returned with errno = EBADF (bad file descriptor).

However, if you call pth_sendto() with fd equal to -1, you get a core
dump, because pth_sendto_ev() calls FD_SET(fd, &fds) without checking
that fd is valid. On FreeBSD at least, this sets a bit outside of the
"fds" memory space and corrupts the stack.

Perhaps in pth_sendto_ev() (and others?) the fd should first be checked
to be between zero and FD_SETSIZE-1 before doing anything else with it.

Cheers,
-Archie

__________________________________________________________________________
Archie Cobbs     *     Packet Design     *     http://www.packetdesign.com
______________________________________________________________________
GNU Portable Threads (Pth)            http://www.gnu.org/software/pth/
User Support Mailing List                            [EMAIL PROTECTED]
Automated List Manager (Majordomo)           [EMAIL PROTECTED]

Reply via email to