Fix possible crash due to unsigned int number wrapping
This commit is contained in:
@@ -765,6 +765,11 @@ int getSSCertificateFingerprint(struct ndpi_detection_module_struct *ndpi_struct
|
|||||||
else if(flow->l4.tcp.tls_srv_cert_fingerprint_processed)
|
else if(flow->l4.tcp.tls_srv_cert_fingerprint_processed)
|
||||||
return(0); /* We're good */
|
return(0); /* We're good */
|
||||||
|
|
||||||
|
if(packet->payload_packet_len <= flow->l4.tcp.tls_record_offset) {
|
||||||
|
/* Avoid invalid memory accesses */
|
||||||
|
return(1);
|
||||||
|
}
|
||||||
|
|
||||||
if(flow->l4.tcp.tls_fingerprint_len > 0) {
|
if(flow->l4.tcp.tls_fingerprint_len > 0) {
|
||||||
unsigned int avail = packet->payload_packet_len - flow->l4.tcp.tls_record_offset;
|
unsigned int avail = packet->payload_packet_len - flow->l4.tcp.tls_record_offset;
|
||||||
|
|
||||||
@@ -817,11 +822,6 @@ int getSSCertificateFingerprint(struct ndpi_detection_module_struct *ndpi_struct
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(packet->payload_packet_len <= flow->l4.tcp.tls_record_offset) {
|
|
||||||
/* Avoid invalid memory accesses */
|
|
||||||
return(1);
|
|
||||||
}
|
|
||||||
|
|
||||||
if(packet->payload[flow->l4.tcp.tls_record_offset] == 0x15 /* Alert */) {
|
if(packet->payload[flow->l4.tcp.tls_record_offset] == 0x15 /* Alert */) {
|
||||||
u_int len = ntohs(*(u_int16_t*)&packet->payload[flow->l4.tcp.tls_record_offset+3]) + 5 /* SSL header len */;
|
u_int len = ntohs(*(u_int16_t*)&packet->payload[flow->l4.tcp.tls_record_offset+3]) + 5 /* SSL header len */;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user