fix dhcp buffer overflow
This commit is contained in:
@@ -78,6 +78,8 @@ void ndpi_search_dhcp_udp(struct ndpi_detection_module_struct *ndpi_struct, stru
|
|||||||
|
|
||||||
while(i < DHCP_VEND_LEN) {
|
while(i < DHCP_VEND_LEN) {
|
||||||
u_int8_t id = dhcp->options[i];
|
u_int8_t id = dhcp->options[i];
|
||||||
|
if(id == 0xFF) break;
|
||||||
|
else {
|
||||||
u_int8_t len = dhcp->options[i+1];
|
u_int8_t len = dhcp->options[i+1];
|
||||||
|
|
||||||
if(len == 0) break;
|
if(len == 0) break;
|
||||||
@@ -102,11 +104,10 @@ void ndpi_search_dhcp_udp(struct ndpi_detection_module_struct *ndpi_struct, stru
|
|||||||
j = ndpi_min(len, sizeof(flow->host_server_name)-1);
|
j = ndpi_min(len, sizeof(flow->host_server_name)-1);
|
||||||
strncpy((char*)flow->host_server_name, name, j);
|
strncpy((char*)flow->host_server_name, name, j);
|
||||||
flow->host_server_name[j] = '\0';
|
flow->host_server_name[j] = '\0';
|
||||||
} else if(id == 0xFF)
|
}
|
||||||
break;
|
|
||||||
|
|
||||||
i += len + 2;
|
i += len + 2;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
//get_u_int16_t(packet->payload, 240) == htons(0x3501)) {
|
//get_u_int16_t(packet->payload, 240) == htons(0x3501)) {
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user