]> git.ipfire.org Git - thirdparty/iproute2.git/commitdiff
iproute2: ss: escape all null bytes in abstract unix domain socket
authorIsaac Boukris <iboukris@gmail.com>
Sat, 29 Oct 2016 19:20:19 +0000 (22:20 +0300)
committerStephen Hemminger <stephen@networkplumber.org>
Sat, 12 Nov 2016 07:16:24 +0000 (10:16 +0300)
Abstract unix domain socket may embed null characters,
these should be translated to '@' when printed by ss the
same way the null prefix is currently being translated.

Signed-off-by: Isaac Boukris <iboukris@gmail.com>
misc/ss.c

index dd77b8153b6da4b0ccf368ada378c02d8ab8ced7..0e28998f5d2e1d6436c8ce8a3ad005103e4b84c0 100644 (file)
--- a/misc/ss.c
+++ b/misc/ss.c
@@ -2895,7 +2895,9 @@ static int unix_show_sock(const struct sockaddr_nl *addr, struct nlmsghdr *nlh,
                memcpy(name, RTA_DATA(tb[UNIX_DIAG_NAME]), len);
                name[len] = '\0';
                if (name[0] == '\0')
-                       name[0] = '@';
+                       for (int i = 0; i < len; i++)
+                               if (name[i] == '\0')
+                                       name[i] = '@';
                stat.name = &name[0];
                memcpy(stat.local.data, &stat.name, sizeof(stat.name));
        }