X-Git-Url: http://git.ozlabs.org/?a=blobdiff_plain;f=pppd%2Foptions.c;h=36cf47fb9338948fb225707c85c9b7ed7f280143;hb=e52aee3c8746d931ec428f6cb1a93dbffbcb740b;hp=ca3f8750c8bb4547895c5057ed3ae937224f0452;hpb=35e5a569c988b1ff865b02a24d9a727a00db4da9;p=ppp.git diff --git a/pppd/options.c b/pppd/options.c index ca3f875..36cf47f 100644 --- a/pppd/options.c +++ b/pppd/options.c @@ -781,10 +781,13 @@ process_option(opt, cmd, argv) if (opt->flags & OPT_STATIC) { strlcpy((char *)(opt->addr), *argv, opt->upper_limit); } else { + char **optptr = (char **)(opt->addr); sv = strdup(*argv); if (sv == NULL) novm("option argument"); - *(char **)(opt->addr) = sv; + if (*optptr) + free(*optptr); + *optptr = sv; } break; @@ -976,7 +979,7 @@ print_option(opt, mainopt, printer, arg) p = (char *) opt->addr2; if ((opt->flags & OPT_STATIC) == 0) p = *(char **)p; - printer("%q", p); + printer(arg, "%q", p); } else if (opt->flags & OPT_A2LIST) { struct option_value *ovp; @@ -1294,9 +1297,10 @@ getword(f, word, newlinep, filename) /* * Store the resulting character for the escape sequence. */ - if (len < MAXWORDLEN-1) + if (len < MAXWORDLEN) { word[len] = value; - ++len; + ++len; + } if (!got) c = getc(f); @@ -1334,9 +1338,10 @@ getword(f, word, newlinep, filename) /* * An ordinary character: store it in the word and get another. */ - if (len < MAXWORDLEN-1) + if (len < MAXWORDLEN) { word[len] = c; - ++len; + ++len; + } c = getc(f); }