Fix heap-overflow error in CAPWAP detunneling code
This commit is contained in:
+15
-11
@@ -1810,22 +1810,26 @@ struct ndpi_proto ndpi_workflow_process_packet(struct ndpi_workflow * workflow,
|
|||||||
/* We dissect ONLY CAPWAP traffic */
|
/* We dissect ONLY CAPWAP traffic */
|
||||||
u_int offset = ip_offset+ip_len+sizeof(struct ndpi_udphdr);
|
u_int offset = ip_offset+ip_len+sizeof(struct ndpi_udphdr);
|
||||||
|
|
||||||
if((offset+40) < header->caplen) {
|
if((offset+1) < header->caplen) {
|
||||||
u_int16_t msg_len = packet[offset+1] >> 1;
|
uint8_t preamble = packet[offset];
|
||||||
|
|
||||||
offset += msg_len;
|
if((preamble & 0x0F) == 0) { /* CAPWAP header */
|
||||||
|
u_int16_t msg_len = (packet[offset+1] & 0xF8) >> 1;
|
||||||
|
|
||||||
if(packet[offset] == 0x02) {
|
offset += msg_len;
|
||||||
/* IEEE 802.11 Data */
|
|
||||||
|
|
||||||
offset += 24;
|
if((offset + 32 < header->caplen) && (packet[offset] == 0x02)) {
|
||||||
/* LLC header is 8 bytes */
|
/* IEEE 802.11 Data */
|
||||||
type = ntohs((u_int16_t)*((u_int16_t*)&packet[offset+6]));
|
|
||||||
|
|
||||||
ip_offset = offset + 8;
|
offset += 24;
|
||||||
|
/* LLC header is 8 bytes */
|
||||||
|
type = ntohs((u_int16_t)*((u_int16_t*)&packet[offset+6]));
|
||||||
|
|
||||||
tunnel_type = ndpi_capwap_tunnel;
|
ip_offset = offset + 8;
|
||||||
goto iph_check;
|
|
||||||
|
tunnel_type = ndpi_capwap_tunnel;
|
||||||
|
goto iph_check;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user