aboutsummaryrefslogtreecommitdiff
path: root/src/lib/protocols/radius.c
diff options
context:
space:
mode:
authoru-devel <36368802+u-devel@users.noreply.github.com>2019-01-12 23:49:24 +0600
committerGitHub <noreply@github.com>2019-01-12 23:49:24 +0600
commit396f794bf47178f0afc983eee3cd4a7f3d1fe686 (patch)
tree52c9da1f8945c1bc0d1c12dfd1b465ba930b5f31 /src/lib/protocols/radius.c
parent97bdfe295d3f7318d1eac3e0020b3b13004f008d (diff)
Update radius.c to RFC2865
According to RFC2865 code can have value up to 13, also payload length ranges should be applied.
Diffstat (limited to 'src/lib/protocols/radius.c')
-rw-r--r--src/lib/protocols/radius.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/lib/protocols/radius.c b/src/lib/protocols/radius.c
index 1c85f48d7..209e71177 100644
--- a/src/lib/protocols/radius.c
+++ b/src/lib/protocols/radius.c
@@ -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);