Code Review
/
vpp.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
review
|
tree
raw
|
patch
| inline |
side by side
(parent:
93bca19
)
api: fix buffer overflow in vl_msg_replay_json
33/34033/3
author
Benoît Ganne
<bganne@cisco.com>
Mon, 11 Oct 2021 11:49:59 +0000
(13:49 +0200)
committer
Ole Tr�an
<otroan@employees.org>
Wed, 27 Oct 2021 08:21:25 +0000
(08:21 +0000)
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>
src/vlibmemory/vlib_api_cli.c
patch
|
blob
|
history
diff --git
a/src/vlibmemory/vlib_api_cli.c
b/src/vlibmemory/vlib_api_cli.c
index
268b682
..
afd145f
100644
(file)
--- 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;
}