]> git.ipfire.org Git - thirdparty/freeradius-server.git/commitdiff
check that the packet is well-formed
authorAlan T. DeKok <aland@freeradius.org>
Tue, 11 Feb 2025 21:19:28 +0000 (16:19 -0500)
committerAlan T. DeKok <aland@freeradius.org>
Tue, 11 Feb 2025 21:19:28 +0000 (16:19 -0500)
rad_decode() doesn't do this, but instead assumes that the packet
is OK.

src/main/fuzzer.c

index f20e5cfff5c3a0a3cfbb74daf6ab29842dc1d58e..93b0e3afb2a6b37c1d929922e957414e46e48942 100644 (file)
@@ -155,8 +155,10 @@ int LLVMFuzzerTestOneInput(const uint8_t *buf, size_t len)
        memcpy(&packet->data, &buf, sizeof(buf)); /* const issues */
        packet->data_len = len;
 
-       (void) rad_decode(packet, NULL, "testing123");
-       if (fr_debug_lvl > 3) vp_printlist(stdout, packet->vps);
+       if (rad_packet_ok(packet, 0, NULL)) {
+               (void) rad_decode(packet, NULL, "testing123");
+               if (fr_debug_lvl > 3) vp_printlist(stdout, packet->vps);
+       }
 
        packet->data = NULL;
        packet->data_len = 0;