Fixed buffer overflow in DNS dissection

This commit is contained in:
Luca Deri
2019-11-26 17:42:59 +01:00
parent c7efd0892f
commit c223bb1f10
2 changed files with 4 additions and 1 deletions
+3 -1
View File
@@ -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);