Commit 56144132 authored by Simon Kelley's avatar Simon Kelley

Fix a couple of crashes on malformed config files.

Thanks to Stephan Zeisberg and
american fuzzy lop http://lcamtuf.coredump.cx/afl/
parent b2a9c571
...@@ -3848,9 +3848,12 @@ err: ...@@ -3848,9 +3848,12 @@ err:
while (arg != last) while (arg != last)
{ {
alias = canonicalise_opt(arg); alias = canonicalise_opt(arg);
if (!alias || !target)
ret_err(_("bad CNAME"));
for (new = daemon->cnames; new; new = new->next) for (new = daemon->cnames; new; new = new->next)
if (hostname_isequal(new->alias, arg)) if (hostname_isequal(new->alias, alias))
ret_err(_("duplicate CNAME")); ret_err(_("duplicate CNAME"));
new = opt_malloc(sizeof(struct cname)); new = opt_malloc(sizeof(struct cname));
new->next = daemon->cnames; new->next = daemon->cnames;
......
...@@ -503,7 +503,8 @@ int parse_hex(char *in, unsigned char *out, int maxlen, ...@@ -503,7 +503,8 @@ int parse_hex(char *in, unsigned char *out, int maxlen,
return -1; return -1;
out[i] = strtol(&in[j*2], NULL, 16); out[i] = strtol(&in[j*2], NULL, 16);
mask = mask << 1; mask = mask << 1;
i++; if (i++ == maxlen)
break;
if (j < bytes - 1) if (j < bytes - 1)
in[(j+1)*2] = sav; in[(j+1)*2] = sav;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment