BUG/MEDIUM: dns: fix accepted_payload_size parser to avoid integer overflow
authorWilly Tarreau <w@1wt.eu>
Tue, 22 Aug 2017 10:01:26 +0000 (12:01 +0200)
committerWilly Tarreau <w@1wt.eu>
Tue, 22 Aug 2017 10:03:46 +0000 (12:03 +0200)
commit0c219be3dffa85b936048cc6b0ca45f3cf684d23
tree44070a1a39694872ff4e6f29a5d29cea643e7832
parentf5f71304b009f6f00fdd521a10295a5314d2ffa4
BUG/MEDIUM: dns: fix accepted_payload_size parser to avoid integer overflow

Since commit 9d8dbbc ("MINOR: dns: Maximum DNS udp payload set to 8192") it's
possible to specify a packet size, but passing too large a size or a negative
size is not detected and results in memset() being performed over a 2GB+ area
upon receipt of the first DNS response, causing runtime crashes.

We now check that the size is not smaller than the smallest packet which is
the DNS header size (12 bytes).

No backport is needed.
include/types/dns.h
src/cfgparse.c