On 7 December 2014 at 10:13, Sami Kerola <kerolasa@xxxxxx> wrote: [snip] > diff --git a/misc-utils/getopt.c b/misc-utils/getopt.c [snip] > @@ -290,9 +283,14 @@ static void add_long_options(struct getopt_control *ctl, char *options) > "-l or --long argument")); > } > add_longopt(ctl, tokptr, arg_opt); > + ctl->long_options_nr++; > } > tokptr = strtok(NULL, ", \t\n"); > } > + ctl->long_options[ctl->long_options_nr].name = NULL; > + ctl->long_options[ctl->long_options_nr].has_arg = 0; > + ctl->long_options[ctl->long_options_nr].flag = NULL; > + ctl->long_options[ctl->long_options_nr].val = 0; > } > > static shell_t shell_type(const char *new_shell) > -- > 2.1.3 Sorry Karel, the submission was incorrect. With the change I sent add_long_options() could overflow. Here is fix to the issue. @@ -290,9 +283,15 @@ static void add_long_options(struct getopt_control *ctl, char *options) "-l or --long argument")); } add_longopt(ctl, tokptr, arg_opt); + ctl->long_options_nr++; } tokptr = strtok(NULL, ", \t\n"); } + add_longopt(&ctl, NULL, 0); /* ensure long_options[] is not full */ + ctl->long_options[ctl->long_options_nr].name = NULL; + ctl->long_options[ctl->long_options_nr].has_arg = 0; + ctl->long_options[ctl->long_options_nr].flag = NULL; + ctl->long_options[ctl->long_options_nr].val = 0; } Also available from: https://github.com/kerolasa/lelux-utiliteetit/commit/9ddfa7e4a7e3e1936688596e14c1632a034b733e or if you want I can re-submit the patch when I am not in office network (that has 'lets make life impossible' firewall design). -- Sami Kerola http://www.iki.fi/kerolasa/ -- 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