Winsock fix

François Gouget fgouget at codeweavers.com
Sat May 5 15:30:44 CDT 2001


   karlf1 at nc.rr.com said:

> Looking in dlls/winsock/socket.c, I see the following in WSOCK32_send:
>
> return (INT16)length;
>
> but WSOCK32_send is declared as:
>
> INT WINAPI WSOCK32_send(SOCKET s, char *buf, INT len, INT flags)
>
> For large values of len (which give large values of length), I think this is
> wrong.

   And he is quite right. If you try this in a test application, you'll
see that when length==40960 this would cause WSOCK32_send to return
-24576. Any application testing for a '<0' condition will report an
error. Oups!
   Here's the fix.


Changelog:

   François Gouget <fgouget at codeweavers.com>

 * dlls/winsock/socket.c
   Fix incorrect cast in WSOCK32_send and WSOCK32_recvfrom
   Fixes bug #182 reported by karlf1 at nc.rr.com

-- 
François Gouget
fgouget at codeweavers.com
-------------- next part --------------
Index: dlls/winsock/socket.c
===================================================================
RCS file: /home/cvs/wine/wine/dlls/winsock/socket.c,v
retrieving revision 1.47
diff -u -r1.47 socket.c
--- dlls/winsock/socket.c	2001/04/10 21:22:34	1.47
+++ dlls/winsock/socket.c	2001/05/05 19:55:03
@@ -1711,7 +1711,7 @@
 #endif
 	    close(fd);
 	    _enable_event(s, FD_READ, 0, 0);
-	    return (INT16)length;
+	    return length;
 	}
 	SetLastError(wsaErrno());
 	close(fd);
@@ -1855,7 +1855,7 @@
 	else
 	{
 	    close(fd);
-	    return (INT16)length;
+	    return length;
 	}
 	close(fd);
     }


More information about the wine-patches mailing list