Added extra TLS memory boundary checks
This commit is contained in:
@@ -390,8 +390,11 @@ static void processCertificateElements(struct ndpi_detection_module_struct *ndpi
|
|||||||
|
|
||||||
i += 3 /* skip the initial patten 55 1D 11 */;
|
i += 3 /* skip the initial patten 55 1D 11 */;
|
||||||
i++; /* skip the first type, 0x04 == BIT STRING, and jump to it's length */
|
i++; /* skip the first type, 0x04 == BIT STRING, and jump to it's length */
|
||||||
|
if(i < packet->payload_packet_len) {
|
||||||
i += (packet->payload[i] & 0x80) ? (packet->payload[i] & 0x7F) : 0; /* skip BIT STRING length */
|
i += (packet->payload[i] & 0x80) ? (packet->payload[i] & 0x7F) : 0; /* skip BIT STRING length */
|
||||||
|
if(i < packet->payload_packet_len) {
|
||||||
i += 2; /* skip the second type, 0x30 == SEQUENCE, and jump to it's length */
|
i += 2; /* skip the second type, 0x30 == SEQUENCE, and jump to it's length */
|
||||||
|
if(i < packet->payload_packet_len) {
|
||||||
i += (packet->payload[i] & 0x80) ? (packet->payload[i] & 0x7F) : 0; /* skip SEQUENCE length */
|
i += (packet->payload[i] & 0x80) ? (packet->payload[i] & 0x7F) : 0; /* skip SEQUENCE length */
|
||||||
i++;
|
i++;
|
||||||
|
|
||||||
@@ -463,6 +466,9 @@ static void processCertificateElements(struct ndpi_detection_module_struct *ndpi
|
|||||||
NDPI_SET_BIT(flow->risk, NDPI_TLS_CERTIFICATE_MISMATCH); /* Certificate mismatch */
|
NDPI_SET_BIT(flow->risk, NDPI_TLS_CERTIFICATE_MISMATCH); /* Certificate mismatch */
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if(rdn_len) flow->protos.stun_ssl.ssl.subjectDN = strdup(rdnSeqBuf);
|
if(rdn_len) flow->protos.stun_ssl.ssl.subjectDN = strdup(rdnSeqBuf);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user