]> git.ipfire.org Git - thirdparty/dhcp.git/commitdiff
If client sends a packet with a larger option buffer than allowed in the standard...
authorTed Lemon <source@isc.org>
Tue, 17 Mar 1998 06:12:17 +0000 (06:12 +0000)
committerTed Lemon <source@isc.org>
Tue, 17 Mar 1998 06:12:17 +0000 (06:12 +0000)
common/options.c

index 3437c7bd7499c0a95a433393e6658566b5dde231..4fb57d46f11a0c5e38484739d3282a7c8e9a9a9c 100644 (file)
@@ -42,7 +42,7 @@
 
 #ifndef lint
 static char copyright[] =
-"$Id: options.c,v 1.28 1998/03/16 06:19:46 mellon Exp $ Copyright (c) 1995, 1996 The Internet Software Consortium.  All rights reserved.\n";
+"$Id: options.c,v 1.29 1998/03/17 06:12:17 mellon Exp $ Copyright (c) 1995, 1996 The Internet Software Consortium.  All rights reserved.\n";
 #endif /* not lint */
 
 #define DHCP_OPTION_DATA
@@ -255,9 +255,15 @@ int cons_options (inpacket, outpacket, mms, options, agent_options,
                /* Enforce a minimum packet size... */
                if (main_buffer_size < (576 - DHCP_FIXED_LEN))
                        main_buffer_size = 576 - DHCP_FIXED_LEN;
-       } else if (bootpp)
-               main_buffer_size = 64;
-       else
+       } else if (bootpp) {
+               if (inpacket) {
+                       main_buffer_size =
+                               inpacket -> packet_length - DHCP_FIXED_LEN;
+                       if (main_buffer_size < 64)
+                               main_buffer_size = 64;
+               } else
+                       main_buffer_size = 64;
+       } else
                main_buffer_size = 576 - DHCP_FIXED_LEN;
 
        /* Set a hard limit at the size of the output buffer. */