[PATCH] netstat: Escape program names before printing

Anton Skorup via busybox <[email protected]> Mon, 13 Jul 2026 08:19:58 +0200
Newsgroups gmane.linux.busybox
Message-ID <[email protected]>
From: Anton Skorup <[email protected]>

Signed-off-by: Anton Skroup <[email protected]>
---
 networking/netstat.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/networking/netstat.c b/networking/netstat.c
index d31928957..d21a3995c 100644
--- a/networking/netstat.c
+++ b/networking/netstat.c
@@ -471,7 +471,7 @@ static void print_inet_line(struct inet_params *param,
 			state_str);
 #if ENABLE_FEATURE_NETSTAT_PRG
 		if (option_mask32 & OPT_prg)
-			printf("%."PROGNAME_WIDTH_STR"s", prg_cache_get(param->inode));
+			printf("%."PROGNAME_WIDTH_STR"s", printable_string(prg_cache_get(param->inode)));
 #endif
 		bb_putchar('\n');
 		free(l);
@@ -645,7 +645,7 @@ static int FAST_FUNC unix_do_one(char *line)
 
 #if ENABLE_FEATURE_NETSTAT_PRG
 	if (option_mask32 & OPT_prg)
-		printf("%-"PROGNAME_WIDTH_STR"s", prg_cache_get(inode));
+		printf("%-"PROGNAME_WIDTH_STR"s", printable_string(prg_cache_get(inode)));
 #endif
 
 	/* TODO: currently we stop at first NUL byte. Is it a problem? */
-- 
2.43.0