From: Isaac Boukris <iboukris@gmail.com>
To: stephen@networkplumber.org, davem@davemloft.net,
netdev@vger.kernel.org, linux-kernel@vger.kernel.org
Cc: Isaac Boukris <iboukris@gmail.com>
Subject: [PATCH] iproute2: ss: escape all null bytes in abstract unix domain socket
Date: Sat, 29 Oct 2016 22:20:19 +0300 [thread overview]
Message-ID: <1477768820-1295-1-git-send-email-iboukris@gmail.com> (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
next reply other threads:[~2016-10-29 19:22 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-10-29 19:20 Isaac Boukris [this message]
2016-10-29 19:20 ` [PATCH] unix: escape all null bytes in abstract unix domain socket 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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1477768820-1295-1-git-send-email-iboukris@gmail.com \
--to=iboukris@gmail.com \
--cc=davem@davemloft.net \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=stephen@networkplumber.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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.