]> git.ipfire.org Git - thirdparty/freeradius-server.git/commitdiff
if the entry is too large for the buffer, discard the file
authorAlan T. DeKok <aland@freeradius.org>
Mon, 12 Feb 2018 20:50:28 +0000 (15:50 -0500)
committerAlan T. DeKok <aland@freeradius.org>
Mon, 12 Feb 2018 20:50:28 +0000 (15:50 -0500)
src/modules/proto_detail/proto_detail_work.c

index e5b5d4bc98b4301abc5c2bbf96b62e8165c0798e..1a205cb464c53ee64d58a53ae5adf93f8050c66e 100644 (file)
@@ -337,6 +337,14 @@ redo:
                MPRINT("FOUND next at %zd, leftover is %zd", packet_len, *leftover);
 
        } else if (!inst->eof) {
+               if ((end - buffer) == buffer_len) {
+                       ERROR("proto_detail (%s): Too large entry (>%d bytes) found at offset %zu: %.*s of file %s",
+                             inst->name, buffer_len,
+                             (size_t)((p - buffer) + inst->header_offset), (int) (end - p), p,
+                             inst->filename_work);
+                       return -1;
+               }
+
                /*
                 *      We're not at EOF, and there is no "next"
                 *      entry.  Remember all of the leftover data in