Fix missing fatal errors when parsing some command-line/config options.

This commit is contained in:
Simon Kelley
2018-07-19 22:00:08 +01:00
parent ab5ceaf74a
commit a3bd7e73d3
2 changed files with 13 additions and 19 deletions

View File

@@ -37,6 +37,10 @@ version 2.80
without DNSSEC RRs to queries with the do-bit set, but only when without DNSSEC RRs to queries with the do-bit set, but only when
DNSSEC validation was not enabled. DNSSEC validation was not enabled.
Thanks to Petr Menšík for spotting this. Thanks to Petr Menšík for spotting this.
Fix missing fatal errors with some malformed options
(server, local, address, rebind-domain-ok, ipset, alias).
Thanks to Eugene Lozovoy for spotting the problem.
version 2.79 version 2.79

View File

@@ -2417,7 +2417,7 @@ static int one_opt(int option, char *arg, char *errstr, char *gen_err, int comma
if (strcmp(arg, "#") == 0) if (strcmp(arg, "#") == 0)
domain = ""; domain = "";
else if (strlen (arg) != 0 && !(domain = canonicalise_opt(arg))) else if (strlen (arg) != 0 && !(domain = canonicalise_opt(arg)))
option = '?'; ret_err(gen_err);
serv = opt_malloc(sizeof(struct server)); serv = opt_malloc(sizeof(struct server));
memset(serv, 0, sizeof(struct server)); memset(serv, 0, sizeof(struct server));
serv->next = newlist; serv->next = newlist;
@@ -2549,7 +2549,7 @@ static int one_opt(int option, char *arg, char *errstr, char *gen_err, int comma
if (strcmp(arg, "#") == 0 || !*arg) if (strcmp(arg, "#") == 0 || !*arg)
domain = ""; domain = "";
else if (strlen(arg) != 0 && !(domain = canonicalise_opt(arg))) else if (strlen(arg) != 0 && !(domain = canonicalise_opt(arg)))
option = '?'; ret_err(gen_err);
ipsets->next = opt_malloc(sizeof(struct ipsets)); ipsets->next = opt_malloc(sizeof(struct ipsets));
ipsets = ipsets->next; ipsets = ipsets->next;
memset(ipsets, 0, sizeof(struct ipsets)); memset(ipsets, 0, sizeof(struct ipsets));
@@ -2564,13 +2564,11 @@ static int one_opt(int option, char *arg, char *errstr, char *gen_err, int comma
memset(ipsets, 0, sizeof(struct ipsets)); memset(ipsets, 0, sizeof(struct ipsets));
ipsets->domain = ""; ipsets->domain = "";
} }
if (!arg || !*arg) if (!arg || !*arg)
{ ret_err(gen_err);
option = '?';
break; for (size = 2, end = arg; *end; ++end)
}
size = 2;
for (end = arg; *end; ++end)
if (*end == ',') if (*end == ',')
++size; ++size;
@@ -2798,12 +2796,6 @@ static int one_opt(int option, char *arg, char *errstr, char *gen_err, int comma
memset (new, 0, sizeof(*new)); memset (new, 0, sizeof(*new));
new->lease_time = DEFLEASE; new->lease_time = DEFLEASE;
if (!arg)
{
option = '?';
break;
}
while(1) while(1)
{ {
for (cp = arg; *cp; cp++) for (cp = arg; *cp; cp++)
@@ -3805,11 +3797,9 @@ err:
if ((k < 2) || if ((k < 2) ||
(!(inet_pton(AF_INET, a[0], &new->in) > 0)) || (!(inet_pton(AF_INET, a[0], &new->in) > 0)) ||
(!(inet_pton(AF_INET, a[1], &new->out) > 0))) (!(inet_pton(AF_INET, a[1], &new->out) > 0)) ||
option = '?'; (k == 3 && !inet_pton(AF_INET, a[2], &new->mask)))
ret_err(_("missing address in alias"));
if (k == 3 && !inet_pton(AF_INET, a[2], &new->mask))
option = '?';
if (dash && if (dash &&
(!(inet_pton(AF_INET, dash, &new->end) > 0) || (!(inet_pton(AF_INET, dash, &new->end) > 0) ||