check ip option lengths (from rws@mit-bold)
authorSam Leffler <sam@ucbvax.Berkeley.EDU>
Sun, 15 Apr 1984 01:51:06 +0000 (17:51 -0800)
committerSam Leffler <sam@ucbvax.Berkeley.EDU>
Sun, 15 Apr 1984 01:51:06 +0000 (17:51 -0800)
SCCS-vsn: sys/netinet/ip_input.c 6.2

usr/src/sys/netinet/ip_input.c

index 8dd3cd0..eced8e3 100644 (file)
@@ -1,4 +1,4 @@
-/*     ip_input.c      6.1     83/08/16        */
+/*     ip_input.c      6.2     84/04/14        */
 
 #include "../h/param.h"
 #include "../h/systm.h"
 
 #include "../h/param.h"
 #include "../h/systm.h"
@@ -462,8 +462,11 @@ ip_dooptions(ip)
                        break;
                if (opt == IPOPT_NOP)
                        optlen = 1;
                        break;
                if (opt == IPOPT_NOP)
                        optlen = 1;
-               else
+               else {
                        optlen = cp[1];
                        optlen = cp[1];
+                       if (optlen <= 0)
+                               break;
+               }
                switch (opt) {
 
                default:
                switch (opt) {
 
                default: