v2.26-rc1~140^2 “getopt: avoid re-terminating long_option list at every update” forgot to terminate the long_options list in the case where -l/--longoptions was not specified at all, so that add_long_options is never called. The resulting garbage may crash getopt if any long options are provided: $ LANG=de_DE getopt -o c -- --help Segmentation fault (core dumped) Signed-off-by: Anders Kaseorg <andersk@xxxxxxx> --- misc-utils/getopt.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/misc-utils/getopt.c b/misc-utils/getopt.c index 01b5883..08e92c0 100644 --- a/misc-utils/getopt.c +++ b/misc-utils/getopt.c @@ -397,6 +397,10 @@ int main(int argc, char *argv[]) } add_longopt(&ctl, NULL, 0); /* init */ + ctl.long_options[0].name = NULL; + ctl.long_options[0].has_arg = 0; + ctl.long_options[0].flag = NULL; + ctl.long_options[0].val = 0; getopt_long_fp = getopt_long; if (argv[1][0] != '-' || ctl.compatible) { -- 2.10.1 -- To unsubscribe from this list: send the line "unsubscribe util-linux" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html