netlabel: out of bound access in cipso_v4_validate()
[pandora-kernel.git] / net / ipv4 / cipso_ipv4.c
index dbec8b5..a8c5d2c 100644 (file)
@@ -1649,6 +1649,10 @@ int cipso_v4_validate(const struct sk_buff *skb, unsigned char **option)
                                goto validate_return_locked;
                        }
 
+               if (opt_iter + 1 == opt_len) {
+                       err_offset = opt_iter;
+                       goto validate_return_locked;
+               }
                tag_len = tag[1];
                if (tag_len > (opt_len - opt_iter)) {
                        err_offset = opt_iter + 1;