Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1512824
| From | David Miller <davem@davemloft.net> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | Re: [PATCH] unix: escape all null bytes in abstract unix domain socket |
| Date | 2016-10-31 20:40 +0100 |
| Message-ID | <syqB4-6Fs-29@gated-at.bofh.it> (permalink) |
| References | <sxHuh-2gb-3@gated-at.bofh.it> <sxHui-2gb-23@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
From: Isaac Boukris <iboukris@gmail.com>
Date: Sat, 29 Oct 2016 22:20:20 +0300
> Abstract unix domain socket may embed null characters,
> these should be translated to '@' when printed out to
> proc the same way the null prefix is currently being
> translated.
>
> This helps for tools such as netstat, lsof and the proc
> based implementation in ss to show all the significant
> bytes of the name (instead of getting cut at the first
> null occurrence).
>
> Signed-off-by: Isaac Boukris <iboukris@gmail.com>
...
> @@ -2805,14 +2805,19 @@ static int unix_seq_show(struct seq_file *seq, void *v)
>
> i = 0;
> len = u->addr->len - sizeof(short);
> - if (!UNIX_ABSTRACT(s))
> + if (!UNIX_ABSTRACT(s)) {
> len--;
> - else {
> + for ( ; i < len; i++)
> + seq_putc(seq,
> + u->addr->name->sun_path[i]);
> + } else {
> seq_putc(seq, '@');
> i++;
> + for ( ; i < len; i++)
> + seq_putc(seq,
> + u->addr->name->sun_path[i] ?:
> + '@');
> }
> - for ( ; i < len; i++)
> - seq_putc(seq, u->addr->name->sun_path[i]);
I think this patch is simpler if you just do the "@" translation
unconditionally, if it'll never trigger for the !UNIX_ABSTRACT case
that is perfectly fine.
Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll 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