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> (cherry picked from commit b1bb513792fecd735effebbd07d867ea93adc9f6)
This commit is contained in:
parent
25e24e522d
commit
22fb6e6ef8
@ -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);
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user