[PATCH v18 05/11] posix: do not allow option name translations for secure programs
Vivien Kraus
vivien@planete-kraus.eu
Sun Nov 23 17:07:32 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 f0af983cf5..a362e7c14f 100644
--- a/posix/getopt.c
+++ b/posix/getopt.c
@@ -197,7 +197,7 @@ match_translated_option_name (char *(*translate) (const char *, const char *,
const char *opt_name)
{
const char *translated = opt_name;
- if (translate != NULL)
+ if (translate != NULL && !__libc_enable_secure)
translated = translate (opt_textdomain, translation_context, opt_name);
return (!strncmp (translated, argument, argument_length)
&& argument_length == strlen (translated));
--
2.34.1
More information about the Libc-alpha
mailing list