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

Bugfix: Don't choke on rpacket_header in ioctlsocket/FIONREAD.

This commit is contained in:
Daniel Collins 2011-11-13 02:12:39 +00:00
parent 57131bb5ff
commit 4340e3f5b2

View File

@ -783,7 +783,6 @@ int PASCAL ioctlsocket(SOCKET fd, long cmd, u_long *argp) {
ipx_socket *sockptr = get_socket(fd);
if(sockptr && cmd == FIONREAD) {
ipx_packet packet;
fd_set fdset;
struct timeval tv = {0,0};
@ -798,13 +797,14 @@ int PASCAL ioctlsocket(SOCKET fd, long cmd, u_long *argp) {
RETURN(0);
}
r = r_recv(sockptr->fd, (char*)&packet, sizeof(packet), MSG_PEEK);
if(r == -1 && WSAGetLastError() != WSAEMSGSIZE) {
RETURN(-1);
char tmp_buf;
if((r = recv_packet(sockptr, &tmp_buf, 1, MSG_PEEK, NULL, 0)) == -1) {
return -1;
}
*(unsigned long*)argp = packet.size;
RETURN(0);
*(unsigned long*)argp = r;
return 0;
}
if(sockptr) {