summaryrefslogtreecommitdiffstats
path: root/src/vnet/lisp-cp/lisp_msg_serdes.c
diff options
context:
space:
mode:
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);