From: Bruno Haible Date: Thu, 18 Jan 2024 00:12:20 +0000 (+0100) Subject: getopt-gnu: Fix out-of-bounds access (regression 2023-12-11). X-Git-Tag: v1.0~514 X-Git-Url: https://gitweb.git.savannah.gnu.org/gitweb/?a=commitdiff_plain;h=675f7fc6d69c483c83b19777a8ef39f60eed05b7;p=gnulib.git getopt-gnu: Fix out-of-bounds access (regression 2023-12-11). * lib/getopt.c (process_long_option): Don't set ambig_set[option_index] if ambig_set is &ambig_fallback. --- diff --git a/ChangeLog b/ChangeLog index 3b86638ea3..63101e5f20 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2024-01-17 Bruno Haible + + getopt-gnu: Fix out-of-bounds access (regression 2023-12-11). + * lib/getopt.c (process_long_option): Don't set ambig_set[option_index] + if ambig_set is &ambig_fallback. + 2024-01-17 Bruno Haible Improve naming of local variables. diff --git a/lib/getopt.c b/lib/getopt.c index 928306304e..f66f119ec5 100644 --- a/lib/getopt.c +++ b/lib/getopt.c @@ -268,7 +268,7 @@ process_long_option (int argc, char **argv, const char *optstring, ambig_set[indfound] = 1; } } - if (ambig_set) + if (ambig_set && ambig_set != &ambig_fallback) ambig_set[option_index] = 1; } }