[PATCH] ws2_32: handle error return from get_sock_fd (Coverity)
Marcus Meissner
marcus at jet.franken.de
Sat Jan 4 10:49:40 CST 2014
1147950 Argument cannot be negative
---
dlls/ws2_32/socket.c | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/dlls/ws2_32/socket.c b/dlls/ws2_32/socket.c
index 0391554..3bfd561 100644
--- a/dlls/ws2_32/socket.c
+++ b/dlls/ws2_32/socket.c
@@ -1178,6 +1178,11 @@ static int set_ipx_packettype(int sock, int ptype)
int fd = get_sock_fd( sock, 0, NULL ), ret = 0;
TRACE("trying to set IPX_PTYPE: %d (fd: %d)\n", ptype, fd);
+ if (fd == -1) {
+ ERR("IPX: %d is not an IPX socket.\n", sock);
+ return SOCKET_ERROR;
+ }
+
/* We try to set the ipx type on ipx socket level. */
#ifdef SOL_IPX
if(setsockopt(fd, SOL_IPX, IPX_TYPE, &ptype, sizeof(ptype)) == -1)
--
1.8.4
More information about the wine-patches
mailing list