diff options
-rw-r--r-- | winsup/cygwin/ChangeLog | 5 | ||||
-rw-r--r-- | winsup/cygwin/fhandler_socket.cc | 2 |
2 files changed, 6 insertions, 1 deletions
diff --git a/winsup/cygwin/ChangeLog b/winsup/cygwin/ChangeLog index 2eb9c45..a815a12 100644 --- a/winsup/cygwin/ChangeLog +++ b/winsup/cygwin/ChangeLog @@ -1,5 +1,10 @@ 2013-02-04 Corinna Vinschen <corinna@vinschen.de> + * fhandler_socket.cc (fhandler_socket::bind): Fix error code for + empty filename. + +2013-02-04 Corinna Vinschen <corinna@vinschen.de> + * fhandler_socket.cc (fhandler_socket::bind): Fix length check of AF_LOCAL filename so it never accesses memory beyond namelen. Also make sure filename is NUL-terminated. diff --git a/winsup/cygwin/fhandler_socket.cc b/winsup/cygwin/fhandler_socket.cc index 6f13e51..8b05f75 100644 --- a/winsup/cygwin/fhandler_socket.cc +++ b/winsup/cygwin/fhandler_socket.cc @@ -906,7 +906,7 @@ fhandler_socket::bind (const struct sockaddr *name, int namelen) if (len <= 1 || len > UNIX_PATH_LEN || !memchr (un_addr->sun_path, '\0', len)) { - set_errno (len < 1 ? EINVAL : ENAMETOOLONG); + set_errno (len <= 1 ? (len == 1 ? ENOENT : EINVAL) : ENAMETOOLONG); goto out; } sin.sin_family = AF_INET; |