common.c: add more metachars in reject_meta_chars()
Some checks failed
Build-extra / build-gcc (push) Has been cancelled
Build-extra / build-clang (push) Has been cancelled
Build / build (push) Has been cancelled
Check-C / scan-build (push) Has been cancelled
Check-C / cppcheck (push) Has been cancelled
Check-C / codeql-cpp (push) Has been cancelled
Codespell / codespell (push) Has been cancelled
Test / test-main (push) Has been cancelled
Test / test-fs (push) Has been cancelled
Test / test-environment (push) Has been cancelled
Test / test-utils (push) Has been cancelled
Test / test-network (push) Has been cancelled

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
This commit is contained in:
Kelvin M. Klann 2026-06-16 14:44:39 -03:00
parent 76d9dd7037
commit ad968e7ebf

View file

@ -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 "*?[]"