mirror of
https://github.com/pi-hole/dnsmasq.git
synced 2025-12-20 02:38:32 +00:00
crash at startup when an empty suffix is supplied to --conf-dir
This commit is contained in:
@@ -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
|
version 2.72
|
||||||
Add ra-advrouter mode, for RFC-3775 mobile IPv6 support.
|
Add ra-advrouter mode, for RFC-3775 mobile IPv6 support.
|
||||||
|
|
||||||
|
|||||||
38
src/option.c
38
src/option.c
@@ -1474,22 +1474,25 @@ static int one_opt(int option, char *arg, char *errstr, char *gen_err, int comma
|
|||||||
for (arg = comma; arg; arg = comma)
|
for (arg = comma; arg; arg = comma)
|
||||||
{
|
{
|
||||||
comma = split(arg);
|
comma = split(arg);
|
||||||
li = opt_malloc(sizeof(struct list));
|
if (strlen(arg) != 0)
|
||||||
if (*arg == '*')
|
|
||||||
{
|
{
|
||||||
li->next = match_suffix;
|
li = opt_malloc(sizeof(struct list));
|
||||||
match_suffix = li;
|
if (*arg == '*')
|
||||||
/* Have to copy: buffer is overwritten */
|
{
|
||||||
li->suffix = opt_string_alloc(arg+1);
|
li->next = match_suffix;
|
||||||
|
match_suffix = li;
|
||||||
|
/* Have to copy: buffer is overwritten */
|
||||||
|
li->suffix = opt_string_alloc(arg+1);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
li->next = ignore_suffix;
|
||||||
|
ignore_suffix = li;
|
||||||
|
/* Have to copy: buffer is overwritten */
|
||||||
|
li->suffix = opt_string_alloc(arg);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
}
|
||||||
{
|
|
||||||
li->next = ignore_suffix;
|
|
||||||
ignore_suffix = li;
|
|
||||||
/* Have to copy: buffer is overwritten */
|
|
||||||
li->suffix = opt_string_alloc(arg);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
if (!(dir_stream = opendir(directory)))
|
if (!(dir_stream = opendir(directory)))
|
||||||
die(_("cannot access directory %s: %s"), directory, EC_FILE);
|
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->suffix);
|
||||||
free(ignore_suffix);
|
free(ignore_suffix);
|
||||||
}
|
}
|
||||||
|
for(; match_suffix; match_suffix = li)
|
||||||
|
{
|
||||||
|
li = match_suffix->next;
|
||||||
|
free(match_suffix->suffix);
|
||||||
|
free(match_suffix);
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user