[PATCH v19 05/11] posix: do not allow option name translations for secure programs
Vivien Kraus
vivien@planete-kraus.eu
Sat Dec 6 13:19:12 GMT 2025
SETUID / SETGID / AT_SECURE programs should not accept translated
names, so that the programmer knows exactly how the program can be
invoked.
---
posix/getopt.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/posix/getopt.c b/posix/getopt.c
index e27c0f53ab..ba2a703174 100644
--- a/posix/getopt.c
+++ b/posix/getopt.c
@@ -199,7 +199,7 @@ match_translated_option_name (char *(*translate) (const char *, const char *,
const char *translated = opt_name;
char *translation_buffer = NULL;
int matches = 0;
- if (translate != NULL)
+ if (translate != NULL && !__libc_enable_secure)
translated = translate (opt_textdomain, translation_context,
opt_name, &translation_buffer);
matches = (!strncmp (translated, argument, argument_length)
--
2.34.1
More information about the Libc-alpha
mailing list