diff options
author | Benoît Ganne <bganne@cisco.com> | 2021-10-11 13:49:59 +0200 |
---|---|---|
committer | Ole Tr�an <otroan@employees.org> | 2021-10-27 08:21:25 +0000 |
commit | 2b9a4bf3b307870324715bab698204f286368cc0 (patch) | |
tree | 8c1c3e90a85f3ef4916855809e1da1883603f446 /src/vlibmemory | |
parent | 93bca19f1e1026a5b49fbd42ec07721a9b83175c (diff) |
api: fix buffer overflow in vl_msg_replay_json
cJSON_Parse() and vlib_cli_output() expect a NULL-terminated C-string.
Type: fix
Fixes: 36217e3ca8a1ca2e7a341b6b44ffc25e6497191c
Change-Id: Id9819314fcd332c6076d1330b3433885fff07e36
Signed-off-by: Benoît Ganne <bganne@cisco.com>
Diffstat (limited to 'src/vlibmemory')
-rw-r--r-- | src/vlibmemory/vlib_api_cli.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/src/vlibmemory/vlib_api_cli.c b/src/vlibmemory/vlib_api_cli.c index 268b682f09a..afd145fe620 100644 --- a/src/vlibmemory/vlib_api_cli.c +++ b/src/vlibmemory/vlib_api_cli.c @@ -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; } |