aboutsummaryrefslogtreecommitdiffstats
path: root/src/vnet/lisp-cp/lisp_msg_serdes.c
diff options
context:
space:
mode:
authorFilip Tehlar <ftehlar@cisco.com>2017-04-26 16:09:06 +0200
committerFlorin Coras <florin.coras@gmail.com>2017-05-03 15:19:23 +0000
commit816f437d943688f67d61fb6b9708eff59432b2ee (patch)
tree565bddb5ad81b00eae739c4438ecb67042dd4218 /src/vnet/lisp-cp/lisp_msg_serdes.c
parentafc47aa36f44d3f865c6e1e48f41eded366a85ac (diff)
Fix vnet unit tests
Change-Id: Ibe55e4399c6b78d83268d7c49ed498cab7bfdb43 Signed-off-by: Filip Tehlar <ftehlar@cisco.com>
Diffstat (limited to 'src/vnet/lisp-cp/lisp_msg_serdes.c')
-rw-r--r--src/vnet/lisp-cp/lisp_msg_serdes.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/vnet/lisp-cp/lisp_msg_serdes.c b/src/vnet/lisp-cp/lisp_msg_serdes.c
index eee1885cd9b..6c0a7219f31 100644
--- a/src/vnet/lisp-cp/lisp_msg_serdes.c
+++ b/src/vnet/lisp-cp/lisp_msg_serdes.c
@@ -312,6 +312,8 @@ lisp_msg_parse_loc (vlib_buffer_t * b, locator_t * loc)
if (len == ~0)
return ~0;
+ if (!vlib_buffer_has_space (b, sizeof (len)))
+ return ~0;
vlib_buffer_pull (b, len);
return len;
@@ -326,6 +328,9 @@ lisp_msg_parse_mapping_record (vlib_buffer_t * b, gid_address_t * eid,
int i = 0, len = 0, llen = 0;
h = vlib_buffer_get_current (b);
+ if (!vlib_buffer_has_space (b, sizeof (mapping_record_hdr_t)))
+ return ~0;
+
vlib_buffer_pull (b, sizeof (mapping_record_hdr_t));
memset (eid, 0, sizeof (*eid));
@@ -333,6 +338,9 @@ lisp_msg_parse_mapping_record (vlib_buffer_t * b, gid_address_t * eid,
if (len == ~0)
return len;
+ if (!vlib_buffer_has_space (b, sizeof (len)))
+ return ~0;
+
vlib_buffer_pull (b, len);
if (GID_ADDR_IP_PREFIX == gid_address_type (eid))
gid_address_ippref_len (eid) = MAP_REC_EID_PLEN (h);