Commit bb201c21 authored by Simon Kelley's avatar Simon Kelley

Protect against malicious DNS replies with very large RRsets.

parent 12fae49f
...@@ -531,6 +531,11 @@ static int validate_rrset(time_t now, struct dns_header *header, size_t plen, in ...@@ -531,6 +531,11 @@ static int validate_rrset(time_t now, struct dns_header *header, size_t plen, in
{ {
unsigned char **new; unsigned char **new;
/* Protect against insane/maliciuos queries which bloat the workspace
and eat CPU in the sort */
if (rrsetidx >= 100)
return STAT_INSECURE;
/* expand */ /* expand */
if (!(new = whine_malloc((rrset_sz + 5) * sizeof(unsigned char **)))) if (!(new = whine_malloc((rrset_sz + 5) * sizeof(unsigned char **))))
return STAT_INSECURE; return STAT_INSECURE;
......
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