api: fix buffer overflow in vl_msg_replay_json
cJSON_Parse() and vlib_cli_output() expect a NULL-terminated C-string.
Type: fix
Fixes: 36217e3ca8
Change-Id: Id9819314fcd332c6076d1330b3433885fff07e36
Signed-off-by: Benoît Ganne <bganne@cisco.com>
This commit is contained in:
@@ -785,6 +785,10 @@ vl_msg_read_file (FILE *f)
|
||||
while ((n = fread (buf, 1, bufsize, f)))
|
||||
vec_add (v, buf, n);
|
||||
|
||||
/* most callers expect a NULL-terminated C-string */
|
||||
if (v)
|
||||
vec_add1 (v, 0);
|
||||
|
||||
return v;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user