From a0271ca1bc031d1d5dcb8325460fbbbe62b358ab Mon Sep 17 00:00:00 2001 From: Amos Jeffries Date: Sat, 16 Jan 2010 16:51:51 +1300 Subject: [PATCH] Handle DNS header-only packets as invalid. --- lib/rfc1035.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/lib/rfc1035.c b/lib/rfc1035.c index 77a4d6ddfe..0552e5cd30 100644 --- a/lib/rfc1035.c +++ b/lib/rfc1035.c @@ -288,6 +288,10 @@ rfc1035NameUnpack(const char *buf, size_t sz, unsigned int *off, unsigned short assert(ns > 0); do { assert((*off) < sz); + if ((*off) >= sz) { + RFC1035_UNPACK_DEBUG; + return 1; + } c = *(buf + (*off)); if (c > 191) { /* blasted compression */ -- 2.47.2