]> git.ipfire.org Git - thirdparty/bind9.git/commit
netmgr: Don't crash if socket() returns an error in udpconnect
authorOndřej Surý <ondrej@sury.org>
Sat, 7 Nov 2020 19:48:37 +0000 (20:48 +0100)
committerOndřej Surý <ondrej@sury.org>
Wed, 9 Dec 2020 09:46:16 +0000 (10:46 +0100)
commitc4dcedd2dc900b604c64475356ecf0ce37285a79
treec7a3d4719d6eb56ae61174261967d5b7172768de
parent21daa258a26342b7560f015b5d4468120ac68cc3
netmgr: Don't crash if socket() returns an error in udpconnect

socket() call can return an error - e.g. EMFILE, so we need to handle
this nicely and not crash.

Additionally wrap the socket() call inside a platform independent helper
function as the Socket data type on Windows is unsigned integer:

> This means, for example, that checking for errors when the socket and
> accept functions return should not be done by comparing the return
> value with –1, or seeing if the value is negative (both common and
> legal approaches in UNIX). Instead, an application should use the
> manifest constant INVALID_SOCKET as defined in the Winsock2.h header
> file.

(cherry picked from commit 8af7f81d6c1f974ac3305186ae34b9ce423525d0)
lib/isc/netmgr/netmgr-int.h
lib/isc/netmgr/netmgr.c
lib/isc/netmgr/udp.c