Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1511867

[PATCH] iproute2: ss: escape all null bytes in abstract unix domain socket

From Isaac Boukris <iboukris@gmail.com>
Newsgroups linux.kernel
Subject [PATCH] iproute2: ss: escape all null bytes in abstract unix domain socket
Date 2016-10-29 21:30 +0200
Message-ID <sxHuh-2gb-3@gated-at.bofh.it> (permalink)
Organization linux.* mail to news gateway

Show all headers | View raw


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 | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/misc/ss.c b/misc/ss.c
index dd77b81..0e28998 100644
--- 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));
 	}
-- 
2.7.4

Back to linux.kernel | Previous | NextNext in thread | Find similar | Unroll thread


Thread

[PATCH] iproute2: ss: escape all null bytes in abstract unix domain socket Isaac Boukris <iboukris@gmail.com> - 2016-10-29 21:30 +0200
  [PATCH] unix: escape all null bytes in abstract unix domain socket Isaac Boukris <iboukris@gmail.com> - 2016-10-29 21:30 +0200
    Re: [PATCH] unix: escape all null bytes in abstract unix domain  socket David Miller <davem@davemloft.net> - 2016-10-31 20:40 +0100
      Re: [PATCH] unix: escape all null bytes in abstract unix domain socket Isaac Boukris <iboukris@gmail.com> - 2016-11-01 02:00 +0100

csiph-web