summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRay Kinsella <mdr@ashroe.eu>2020-04-07 16:35:22 +0100
committerDave Barach <openvpp@barachs.net>2020-04-07 21:05:53 +0000
commitb1bb513792fecd735effebbd07d867ea93adc9f6 (patch)
tree9f5373c57970f815b19b39c60c9be1e6b1b368a4
parent26c9d4b0cd9c53054d1174bc15aaf8c07e9a8f93 (diff)
vat: fix vat strncpy stringop-overflow
Fix GCC 9.0 barf on vat strncpy. Type: fix Signed-off-by: Ray Kinsella <mdr@ashroe.eu> Change-Id: I5e41225d6ac9673a9d953046720df55e7b69c479 Signed-off-by: Dave Barach <dave@barachs.net>
-rw-r--r--src/vat/json_format.h3
1 files changed, 1 insertions, 2 deletions
diff --git a/src/vat/json_format.h b/src/vat/json_format.h
index d2fab9020b3..260c32ede25 100644
--- a/src/vat/json_format.h
+++ b/src/vat/json_format.h
@@ -95,8 +95,7 @@ vat_json_set_string_copy (vat_json_node_t * json, const u8 * str)
u8 *ns = NULL;
int len = strlen ((const char *) str);
vec_validate (ns, len);
- strncpy ((char *) ns, (const char *) str, len + 1);
- vec_add1 (ns, '\0');
+ memcpy ((char *) ns, (const char *) str, len + 1);
vat_json_set_string (json, ns);
}