X-Git-Url: http://git.ozlabs.org/?a=blobdiff_plain;f=pppd%2Foptions.c;h=c06a2b4ad8ed4560501dfeb61902946c14ea7d96;hb=dfd33d7f526ecd7b39dd1bba8101260d02af5ebb;hp=ca3f8750c8bb4547895c5057ed3ae937224f0452;hpb=35e5a569c988b1ff865b02a24d9a727a00db4da9;p=ppp.git diff --git a/pppd/options.c b/pppd/options.c index ca3f875..c06a2b4 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; @@ -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); }