From ad968e7ebfecb3faa9d3a4016cd1cee432481369 Mon Sep 17 00:00:00 2001 From: "Kelvin M. Klann" Date: Tue, 16 Jun 2026 14:44:39 -0300 Subject: [PATCH] common.c: add more metachars in `reject_meta_chars()` Add: * `#$|` Ignore: * `'()~` Note: `,` does not appear to be a metacharacter, but it (and `%`) are checked in test/fcopy/cmdline.exp. I'm not sure if they matter for fcopy, so they are left as is. Misc: `$` was suggested by @rusty-snake[1]. This is a follow-up to #7183. Relates to #3001 #3156 #4614. [1] https://github.com/netblue30/firejail/pull/7183#issuecomment-4709569497 --- src/lib/common.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/lib/common.c b/src/lib/common.c index 7ef5c7271..60e2fcfa1 100644 --- a/src/lib/common.c +++ b/src/lib/common.c @@ -484,8 +484,15 @@ void reject_cntrl_chars(const char *fname) { } } +// Note: Characters intentionally ignored: +// +// * `'`: Used in some dirnames (see #4614). +// * `()`: Used in some dirnames (see #3001 #3156). +// * `~`: Might be useful for expansion and seems unlikely to cause problems by +// itself. #ifndef METACHARS -#define METACHARS "!\"%&,;<>\\^`{}" +// All metachars except for ignored chars and chars in other groups. +#define METACHARS "!\"#$%&',;<>\\^`{|}" #endif #ifndef GLOBCHARS #define GLOBCHARS "*?[]"