aboutsummaryrefslogtreecommitdiffstats
path: root/src/plugins
diff options
context:
space:
mode:
authorFilip Varga <fivarga@cisco.com>2019-05-03 22:06:16 +0200
committerOle Trøan <otroan@employees.org>2019-05-09 14:03:55 +0000
commitca76831df3b6abd3c4af6381b873d9f589f20af7 (patch)
tree957f6171165ebddc75f0220a0604f393016ed2bc /src/plugins
parent2233f85694c92a7f2c106ed4e6c50ad145dfb4e2 (diff)
NAT: VPP-1665 coverity scan issue fix
Change-Id: I092a9f8237a895f907590772f2ea213a86502fb4 Signed-off-by: Filip Varga <fivarga@cisco.com>
Diffstat (limited to 'src/plugins')
-rw-r--r--src/plugins/nat/nat_api.c11
1 files changed, 9 insertions, 2 deletions
diff --git a/src/plugins/nat/nat_api.c b/src/plugins/nat/nat_api.c
index 5c6d957a708..1dad4e42728 100644
--- a/src/plugins/nat/nat_api.c
+++ b/src/plugins/nat/nat_api.c
@@ -1190,6 +1190,14 @@ static void
goto send_reply;
}
+ len = vl_api_string_len (&mp->tag);
+
+ if (len > 64)
+ {
+ rv = VNET_API_ERROR_INVALID_VALUE;
+ goto send_reply;
+ }
+
memcpy (&local_addr.as_u8, mp->local_ip_address, 4);
memcpy (&external_addr.as_u8, mp->external_ip_address, 4);
@@ -1208,9 +1216,8 @@ static void
else if (mp->flags & NAT_API_IS_SELF_TWICE_NAT)
twice_nat = TWICE_NAT_SELF;
- len = vl_api_string_len (&mp->tag);
-
tag = vec_new (u8, len);
+
memcpy (tag, mp->tag.buf, len);
vec_terminate_c_string (tag);