diff options
author | Luca Deri <deri@ntop.org> | 2019-11-26 17:42:59 +0100 |
---|---|---|
committer | Luca Deri <deri@ntop.org> | 2019-11-26 17:42:59 +0100 |
commit | c223bb1f10068c00aaf9e9c96709dc3984a969cb (patch) | |
tree | eccd6e5b1ddeab7c0598412c8065795aee0e80c7 /src/lib/protocols/dns.c | |
parent | c7efd0892f1f9299360956b740044a798123a773 (diff) |
Fixed buffer overflow in DNS dissection
Diffstat (limited to 'src/lib/protocols/dns.c')
-rw-r--r-- | src/lib/protocols/dns.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/src/lib/protocols/dns.c b/src/lib/protocols/dns.c index 7051b2227..3fbb39915 100644 --- a/src/lib/protocols/dns.c +++ b/src/lib/protocols/dns.c @@ -47,7 +47,9 @@ static u_int16_t get16(int *i, const u_int8_t *payload) { /* *********************************************** */ static u_int getNameLength(u_int i, const u_int8_t *payload, u_int payloadLen) { - if(payload[i] == 0x00) + if(i >= payloadLen) + return(0); + else if(payload[i] == 0x00) return(1); else if(payload[i] == 0xC0) return(2); |