[PATCH v22 5/9] posix: do not allow option name translations for secure programs

Vivien Kraus vivien@planete-kraus.eu
Thu Apr 23 16:04:03 GMT 2026


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 ae823eec29..399abeea74 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;
   bool matches = false;
-  if (translate != NULL)
+  if (translate != NULL && !__libc_enable_secure)
     translated = translate (opt_textdomain, translation_context,
 			    opt_name, &translation_buffer);
 
-- 
2.52.0



More information about the Libc-alpha mailing list