Update radius.c to RFC2865

According to RFC2865 code can have value up to 13, also payload length ranges should be applied.
This commit is contained in:
u-devel
2019-01-12 23:49:24 +06:00
committed by GitHub
parent 97bdfe295d
commit 396f794bf4
+4 -1
View File
@@ -39,10 +39,13 @@ static void ndpi_check_radius(struct ndpi_detection_module_struct *ndpi_struct,
if(packet->udp != NULL) {
struct radius_header *h = (struct radius_header*)packet->payload;
/* RFC2865: The minimum length is 20 and maximum length is 4096. */
if((payload_len < 20) || (payload_len > 4096))
return;
if((payload_len > sizeof(struct radius_header))
&& (h->code > 0)
&& (h->code <= 5)
&& (h->code <= 13)
&& (ntohs(h->len) == payload_len)) {
NDPI_LOG_INFO(ndpi_struct, "Found radius\n");
ndpi_set_detected_protocol(ndpi_struct, flow, NDPI_PROTOCOL_RADIUS, NDPI_PROTOCOL_UNKNOWN);