From f141d3e24f7ef85901fa2004a1fc632143014b4e Mon Sep 17 00:00:00 2001 From: leitner Date: Fri, 5 Aug 2005 15:45:22 +0000 Subject: [PATCH] socket_accept4 should cope with being passed NULL pointers --- socket/socket_accept4.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/socket/socket_accept4.c b/socket/socket_accept4.c index 7eeec84..7b9732d 100644 --- a/socket/socket_accept4.c +++ b/socket/socket_accept4.c @@ -13,7 +13,7 @@ int socket_accept4(int s,char *ip,uint16 *port) { int fd; if ((fd=accept(s,(void*) &si,&len))==-1) return winsock2errno(-1); - *(uint32*)ip = *(uint32*)&si.sin_addr; - uint16_unpack_big((char *) &si.sin_port,port); + if (ip) *(uint32*)ip = *(uint32*)&si.sin_addr; + if (port) uint16_unpack_big((char *) &si.sin_port,port); return fd; }