Fix possible infinite loop in IPv6 hop-by-hop header parsing 32/732/2
authorYoann Desmouceaux <ydesmouc@cisco.com>
Mon, 11 Apr 2016 08:38:23 +0000 (10:38 +0200)
committerGerrit Code Review <gerrit@fd.io>
Mon, 11 Apr 2016 14:49:56 +0000 (14:49 +0000)
Unknown hop-by-hop options are currently not processed, which triggers an
infinite loop due to the pointer not advancing further in the header.

Change-Id: Idf9176090e042b17aac1baa25a6cb4beb8c199d8
Signed-off-by: Yoann Desmouceaux <ydesmouc@cisco.com>
vnet/vnet/ip/ip6_hop_by_hop.c

index 74f7950..bd96c9b 100644 (file)
@@ -429,6 +429,12 @@ ip6_hop_by_hop_node_fn (vlib_main_t * vm,
                 case 0: /* Pad */
                   opt0 = (ip6_hop_by_hop_option_t *) ((u8 *)opt0) + 1;
                   goto out0;
+
+                default:
+                  opt0 = (ip6_hop_by_hop_option_t *)
+                  (((u8 *)opt0) + opt0->length
+                  + sizeof (ip6_hop_by_hop_option_t));
+                  break;
                 }
             }