[newlib-cygwin] Cygwin: AF_UNIX: fix creating abstract socket symlink name

Corinna Vinschen corinna@sourceware.org
Mon Mar 12 09:21:00 GMT 2018


commit 1bb3d6518222fad8e8a40d9af431459b47d03554
Author: Corinna Vinschen <corinna@vinschen.de>
Date:   Sat Mar 10 21:07:46 2018 +0100

    Cygwin: AF_UNIX: fix creating abstract socket symlink name
    Add missing NUL termination when creating symlink representing
    abstract socket.
    Signed-off-by: Corinna Vinschen <corinna@vinschen.de>

 winsup/cygwin/fhandler_socket_unix.cc | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/winsup/cygwin/fhandler_socket_unix.cc b/winsup/cygwin/fhandler_socket_unix.cc
index f3f3fba..9ac9b24 100644
--- a/winsup/cygwin/fhandler_socket_unix.cc
+++ b/winsup/cygwin/fhandler_socket_unix.cc
@@ -223,7 +223,8 @@ fhandler_socket_unix::create_abstract_link (const sun_name_t *sun,
   /* NUL bytes have no special meaning in an abstract socket name, so
      we assume iso-8859-1 for simplicity and transpose the string.
      transform_chars_af_unix is doing just that. */
-  transform_chars_af_unix (p, sun->un.sun_path, sun->un_len);
+  p = transform_chars_af_unix (p, sun->un.sun_path, sun->un_len);
+  *p = L'\0';
   RtlInitUnicodeString (&uname, name);
   InitializeObjectAttributes (&attr, &uname, OBJ_CASE_INSENSITIVE,
 			      get_shared_parent_dir (), NULL);

More information about the Cygwin-cvs mailing list