All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] iproute2: ss: escape all null bytes in abstract unix domain socket
@ 2016-10-29 19:20 Isaac Boukris
  2016-10-29 19:20 ` [PATCH] unix: " Isaac Boukris
  2016-11-12  7:17 ` [PATCH] iproute2: ss: " Stephen Hemminger
  0 siblings, 2 replies; 9+ messages in thread
From: Isaac Boukris @ 2016-10-29 19:20 UTC (permalink / raw)
  To: stephen, davem, netdev, linux-kernel; +Cc: Isaac Boukris

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

^ permalink raw reply related	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2016-12-05  5:38 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-10-29 19:20 [PATCH] iproute2: ss: escape all null bytes in abstract unix domain socket Isaac Boukris
2016-10-29 19:20 ` [PATCH] unix: " Isaac Boukris
2016-10-31 19:31   ` David Miller
2016-11-01  0:56     ` Isaac Boukris
2016-11-12  7:17 ` [PATCH] iproute2: ss: " Stephen Hemminger
2016-12-02 18:59   ` Eric Dumazet
2016-12-02 23:18     ` Stephen Hemminger
2016-12-02 23:24       ` Eric Dumazet
2016-12-05  5:38         ` Isaac Boukris

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.