crash at startup when an empty suffix is supplied to --conf-dir

This commit is contained in:
Simon Kelley
2014-10-02 21:44:21 +01:00
parent f2658275b2
commit 00cd9d5519
2 changed files with 29 additions and 15 deletions

View File

@@ -1,3 +1,9 @@
version 2.73
Fix crash at startup when an empty suffix is supplied to
--conf-dir, also trivial memory leak. Thanks to
Tomas Hozza for spotting this.
version 2.72
Add ra-advrouter mode, for RFC-3775 mobile IPv6 support.

View File

@@ -1474,6 +1474,8 @@ static int one_opt(int option, char *arg, char *errstr, char *gen_err, int comma
for (arg = comma; arg; arg = comma)
{
comma = split(arg);
if (strlen(arg) != 0)
{
li = opt_malloc(sizeof(struct list));
if (*arg == '*')
{
@@ -1489,7 +1491,8 @@ static int one_opt(int option, char *arg, char *errstr, char *gen_err, int comma
/* Have to copy: buffer is overwritten */
li->suffix = opt_string_alloc(arg);
}
};
}
}
if (!(dir_stream = opendir(directory)))
die(_("cannot access directory %s: %s"), directory, EC_FILE);
@@ -1555,7 +1558,12 @@ static int one_opt(int option, char *arg, char *errstr, char *gen_err, int comma
free(ignore_suffix->suffix);
free(ignore_suffix);
}
for(; match_suffix; match_suffix = li)
{
li = match_suffix->next;
free(match_suffix->suffix);
free(match_suffix);
}
break;
}