Skip to content

netstat: Keep UTF-8 characters in process names#68

Open
stanislav-brabec wants to merge 1 commit into
ecki:masterfrom
stanislav-brabec:master
Open

netstat: Keep UTF-8 characters in process names#68
stanislav-brabec wants to merge 1 commit into
ecki:masterfrom
stanislav-brabec:master

Conversation

@stanislav-brabec

Copy link
Copy Markdown
Contributor

Commit 9beab79 fixed possible ANSI terminal injection. But it also started to sanitize UTF-8 characters in process names making them unreadable.

For example
(ln -sf /usr/bin/nc /tmp/ncáéí; /tmp/nc* -l 31337 &); netstat -alp was now converted to:
nc......
With this change:
If LC_CTYPE refers to UTF-8 locale:
ncáéí
Otherwise:
nc??????

Convert special characters to "?" instead of ".".

These changes make display names compatible with psmisc ps and iproute2 ss.

The escape.c code is based on procps and modified by Stephen Hemminger stephen@networkplumber.org for iproute2 ss.

Reference: https://lore.kernel.org/all/20250204162429.17902-1-stephen@networkplumber.org/

Due to the licensing reasons, the code is kept in a separate file in lib. But it is not added to the library.

Reference: #57

Commit 9beab79 fixed possible ANSI terminal injection. But it also started
to sanitize UTF-8 characters in process names making them unreadable.

For example
(ln -sf /usr/bin/nc /tmp/ncáéí; /tmp/nc* -l 31337 &); netstat -alp
was now converted to:
nc......
With this change:
If LC_CTYPE refers to UTF-8 locale:
ncáéí
Otherwise:
nc??????

Convert special characters to "?" instead of ".".

These changes make display names compatible with psmisc ps and iproute2 ss.

The escape.c code is based on procps and modified by
Stephen Hemminger <stephen@networkplumber.org> for iproute2 ss.

Reference: https://lore.kernel.org/all/20250204162429.17902-1-stephen@networkplumber.org/

Due to the licensing reasons, the code is kept in a separate file in lib.
But it is not added to the library.

Reference: ecki#57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant