From 26e67400ba7bfac5b1e900979f0d12144302241b Mon Sep 17 00:00:00 2001 From: Victor Julien Date: Tue, 16 Aug 2016 15:54:43 +0200 Subject: [PATCH] dns: fix name parsing issue leading to events --- src/app-layer-dns-common.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) 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; } -- 2.47.2