PPPD crashes (SEGV) when the 'dump' or 'dryrun' options are specified and an option defined internally as "o_special" with an option flag of "OPT_A2STRVAL" is used. The crash occurs because the option value is not saved when the parameter is processed, but is then referenced when printed. This was encountered using xl2tpd and the l2tp_ppp kernel module; the option PPPD crashed on is "pppol2tp 8". The attached patch corrects the parameter processing to save the option value.
Signed-off-by: Nathan Hintz <[email protected]> --- /dev/null +++ package/network/services/ppp/patches/501-save_arg_for_o_special_OPT_A2STRVAL.patch @@ -0,0 +1,20 @@ +--- a/pppd/options.c ++++ b/pppd/options.c +@@ -809,7 +809,16 @@ process_option(opt, cmd, argv) + parser = (int (*) __P((char **))) opt->addr; + if (!(*parser)(argv)) + return 0; +- if (opt->flags & OPT_A2LIST) { ++ if (opt->flags & OPT_A2STRVAL) { ++ if (opt->flags & OPT_STATIC) { ++ strlcpy((char *)(opt->addr2), *argv, opt->upper_limit); ++ } else { ++ sv = strdup(*argv); ++ if (sv == NULL) ++ novm("option argument"); ++ *(char **)(opt->addr2) = sv; ++ } ++ } else if (opt->flags & OPT_A2LIST) { + struct option_value *ovp, *pp; + + ovp = malloc(sizeof(*ovp) + strlen(*argv)); _______________________________________________ openwrt-devel mailing list [email protected] https://lists.openwrt.org/mailman/listinfo/openwrt-devel
