Boundary check on QUIC
This commit is contained in:
@@ -124,14 +124,16 @@ void ndpi_search_quic(struct ndpi_detection_module_struct *ndpi_struct,
|
||||
&& (packet->payload[i+3] == 0)) {
|
||||
u_int32_t offset = (*((u_int32_t*)&packet->payload[i+4]));
|
||||
u_int32_t prev_offset = (*((u_int32_t*)&packet->payload[i-4]));
|
||||
int len = offset-prev_offset;
|
||||
int sni_offset = i+prev_offset+1;
|
||||
|
||||
if(offset > prev_offset) {
|
||||
u_int32_t len = offset-prev_offset;
|
||||
u_int32_t sni_offset = i+prev_offset+1;
|
||||
|
||||
while((sni_offset < udp_len) && (packet->payload[sni_offset] == '-'))
|
||||
sni_offset++;
|
||||
|
||||
if(len > 0 && (sni_offset+len) < udp_len) {
|
||||
int max_len = sizeof(flow->host_server_name)-1, j = 0;
|
||||
u_int32_t max_len = sizeof(flow->host_server_name)-1, j = 0;
|
||||
ndpi_protocol_match_result ret_match;
|
||||
|
||||
if(len > max_len) len = max_len;
|
||||
@@ -153,6 +155,7 @@ void ndpi_search_quic(struct ndpi_detection_module_struct *ndpi_struct,
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user