From: Ray Kinsella Date: Tue, 7 Apr 2020 15:35:22 +0000 (+0100) Subject: vat: fix vat strncpy stringop-overflow X-Git-Tag: v20.09-rc0~258 X-Git-Url: https://gerrit.fd.io/r/gitweb?p=vpp.git;a=commitdiff_plain;h=b1bb513792fecd735effebbd07d867ea93adc9f6 vat: fix vat strncpy stringop-overflow Fix GCC 9.0 barf on vat strncpy. Type: fix Signed-off-by: Ray Kinsella Change-Id: I5e41225d6ac9673a9d953046720df55e7b69c479 Signed-off-by: Dave Barach --- 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); }