From: Victor Julien Date: Tue, 16 Aug 2016 13:54:43 +0000 (+0200) Subject: dns: fix name parsing issue leading to events X-Git-Tag: suricata-3.1.2~45 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=26e67400ba7bfac5b1e900979f0d12144302241b;p=thirdparty%2Fsuricata.git dns: fix name parsing issue leading to events --- diff --git a/src/app-layer-dns-common.c b/src/app-layer-dns-common.c index cfb441451b..0f4595ac2c 100644 --- a/src/app-layer-dns-common.c +++ b/src/app-layer-dns-common.c @@ -730,7 +730,11 @@ static uint16_t DNSResponseGetNameByOffset(const uint8_t * const input, const ui } qdata += length; - if ((uint64_t)((qdata + 1) - input) >= (uint64_t)input_len) { + /* if we're at the end of the input data, we're done */ + if ((uint64_t)((qdata + 1) - input) == (uint64_t)input_len) { + break; + } + else if ((uint64_t)((qdata + 1) - input) > (uint64_t)input_len) { SCLogDebug("input buffer too small"); goto insufficient_data; }