From: Isaac Boukris Date: Sat, 29 Oct 2016 19:20:19 +0000 (+0300) Subject: iproute2: ss: escape all null bytes in abstract unix domain socket X-Git-Tag: v4.9.0~41 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=878dadc79d247aa37b67fb30608e58ef1f9ab9ff;p=thirdparty%2Fiproute2.git iproute2: ss: escape all null bytes in abstract unix domain socket 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 --- diff --git a/misc/ss.c b/misc/ss.c index dd77b8153..0e28998f5 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)); }