diff options
author | netblue30 <netblue30@protonmail.com> | 2023-02-14 09:27:50 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-02-14 09:27:50 -0500 |
commit | 31d0c32be58413897780606b55b2e60026f9a47c (patch) | |
tree | 195c459f44637f963c792d95161e528c18106133 /src/lib/pid.c | |
parent | merges, disable sort.py in profile checks temporarely, two more private-etc p... (diff) | |
parent | Style changes (diff) | |
download | firejail-31d0c32be58413897780606b55b2e60026f9a47c.tar.gz firejail-31d0c32be58413897780606b55b2e60026f9a47c.tar.zst firejail-31d0c32be58413897780606b55b2e60026f9a47c.zip |
Merge pull request #5613 from layderv/escape-cntrl-sequences
modif: Escape control characters of the command line
Diffstat (limited to 'src/lib/pid.c')
-rw-r--r-- | src/lib/pid.c | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/src/lib/pid.c b/src/lib/pid.c index 5e9b20c94..2e73e85f6 100644 --- a/src/lib/pid.c +++ b/src/lib/pid.c | |||
@@ -197,6 +197,12 @@ static void print_elem(unsigned index, int nowrap) { | |||
197 | char *user = pid_get_user_name(uid); | 197 | char *user = pid_get_user_name(uid); |
198 | char *user_allocated = user; | 198 | char *user_allocated = user; |
199 | 199 | ||
200 | char *cmd_escaped = escape_cntrl_chars(cmd); | ||
201 | if (cmd_escaped) { | ||
202 | free(cmd); | ||
203 | cmd = cmd_escaped; | ||
204 | } | ||
205 | |||
200 | // extract sandbox name - pid == index | 206 | // extract sandbox name - pid == index |
201 | char *sandbox_name = ""; | 207 | char *sandbox_name = ""; |
202 | char *sandbox_name_allocated = NULL; | 208 | char *sandbox_name_allocated = NULL; |
@@ -224,7 +230,15 @@ static void print_elem(unsigned index, int nowrap) { | |||
224 | } | 230 | } |
225 | free(fname); | 231 | free(fname); |
226 | 232 | ||
227 | if (user ==NULL) | 233 | char *sandbox_name_escaped = escape_cntrl_chars(sandbox_name); |
234 | if (sandbox_name_escaped) { | ||
235 | if (sandbox_name_allocated) | ||
236 | free(sandbox_name_allocated); | ||
237 | sandbox_name = sandbox_name_escaped; | ||
238 | sandbox_name_allocated = sandbox_name; | ||
239 | } | ||
240 | |||
241 | if (user == NULL) | ||
228 | user = ""; | 242 | user = ""; |
229 | if (cmd) { | 243 | if (cmd) { |
230 | if (col < 4 || nowrap) | 244 | if (col < 4 || nowrap) |