1
0
mirror of https://github.com/solemnwarning/ipxwrapper synced 2024-12-30 16:45:37 +01:00

Fixed segfault in recvfrom when called with NULL addrlen.

This commit is contained in:
Daniel Collins 2014-01-11 18:23:17 +00:00
parent 34ae708491
commit 018c66873f
2 changed files with 14 additions and 1 deletions

View File

@ -5,6 +5,8 @@ Version XXX:
protocol value correctly. protocol value correctly.
Bugfix: Removed conflicting send and connect functions. Bugfix: Removed conflicting send and connect functions.
Bugfix: Fixed segfault in recvfrom when called with NULL addrlen.
Version 0.4.1: Version 0.4.1:
Feature: Added workaround for point-to-point links. Feature: Added workaround for point-to-point links.

View File

@ -625,7 +625,7 @@ int WSAAPI recvfrom(SOCKET fd, char *buf, int len, int flags, struct sockaddr *a
int extended_addr = sock->flags & IPX_EXT_ADDR; int extended_addr = sock->flags & IPX_EXT_ADDR;
int rval = recv_packet(sock, buf, len, flags, (struct sockaddr_ipx_ext*)addr, *addrlen); int rval = recv_packet(sock, buf, len, flags, (struct sockaddr_ipx_ext*)(addr), (addrlen ? *addrlen : 0));
/* The value pointed to by addrlen is only set if the /* The value pointed to by addrlen is only set if the
* recv call was successful, may not be correct. * recv call was successful, may not be correct.
@ -703,6 +703,9 @@ int PASCAL WSARecvEx(SOCKET fd, char *buf, int len, int *flags)
* *
* I _THINK_ it should return the amount of data * I _THINK_ it should return the amount of data
* actually copied to the buffer. * actually copied to the buffer.
*
* Windows 95/98: Returns -1
* Windows 2000/XP: Returns len
*/ */
rval = len; rval = len;
@ -752,6 +755,14 @@ int WSAAPI getsockopt(SOCKET fd, int level, int optname, char FAR *optval, int F
{ {
if(optname == IPX_PTYPE) if(optname == IPX_PTYPE)
{ {
/* NOTE: Windows 95/98 only write to the first
* byte of the buffer, leaving the rest
* uninitialised. Windows 2000/XP write all 4
* bytes.
*
* Both require optlen to be at least 4.
*/
RETURN_INT_OPT(sock->s_ptype); RETURN_INT_OPT(sock->s_ptype);
} }
else if(optname == IPX_FILTERPTYPE) else if(optname == IPX_FILTERPTYPE)