diff options
author | Corinna Vinschen <corinna@vinschen.de> | 2009-06-13 16:13:01 +0000 |
---|---|---|
committer | Corinna Vinschen <corinna@vinschen.de> | 2009-06-13 16:13:01 +0000 |
commit | 792c564b27fc4b79f2e2936acc8e09ec3d1e7f39 (patch) | |
tree | 1cdc7e95194f000c5b78b5cd2176eb25765dca81 | |
parent | 2476ec9bdfdb5f626f1d06bc13a8d2ef5b17caae (diff) | |
download | newlib-792c564b27fc4b79f2e2936acc8e09ec3d1e7f39.zip newlib-792c564b27fc4b79f2e2936acc8e09ec3d1e7f39.tar.gz newlib-792c564b27fc4b79f2e2936acc8e09ec3d1e7f39.tar.bz2 |
* fhandler_socket.cc (fhandler_socket::recv_internal): Set namelen
pointer to NULL if name pointer is NULL. Explain why.
-rw-r--r-- | winsup/cygwin/ChangeLog | 5 | ||||
-rw-r--r-- | winsup/cygwin/fhandler_socket.cc | 7 |
2 files changed, 11 insertions, 1 deletions
diff --git a/winsup/cygwin/ChangeLog b/winsup/cygwin/ChangeLog index cc19f0c..55ecac0 100644 --- a/winsup/cygwin/ChangeLog +++ b/winsup/cygwin/ChangeLog @@ -1,3 +1,8 @@ +2009-06-13 Corinna Vinschen <corinna@vinschen.de> + + * fhandler_socket.cc (fhandler_socket::recv_internal): Set namelen + pointer to NULL if name pointer is NULL. Explain why. + 2009-06-12 Corinna Vinschen <corinna@vinschen.de> * localtime.cc (time2): Change "spring gap" to "spring forward gap" diff --git a/winsup/cygwin/fhandler_socket.cc b/winsup/cygwin/fhandler_socket.cc index 7ab1ce8..93af60e 100644 --- a/winsup/cygwin/fhandler_socket.cc +++ b/winsup/cygwin/fhandler_socket.cc @@ -1347,7 +1347,12 @@ fhandler_socket::recv_internal (LPWSAMSG wsamsg) res = WSARecvMsg (get_socket (), wsamsg, &wret, NULL, NULL); else res = WSARecvFrom (get_socket (), wsabuf, wsacnt, &wret, - &wsamsg->dwFlags, wsamsg->name, &wsamsg->namelen, + &wsamsg->dwFlags, wsamsg->name, + /* Winsock returns WSAEFAULT if namelen is a valid + pointer while name is NULL. Both parameters are + ignored for TCP sockets, so this only occurs when + using UDP socket. */ + wsamsg->name ? &wsamsg->namelen : NULL, NULL, NULL); if (!res) { |