summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorOle Troan <ot@cisco.com>2021-02-17 13:26:53 +0100
committerNeale Ranns <neale@graphiant.com>2021-02-17 15:51:22 +0000
commitedc73fddbaa28eb29d068d3078f1c437781605ad (patch)
tree733e8cb0eccb0f137d4d3e4dbdadd24356c7dd2a
parent384c72f630b7e8623a5122991d7c6abe6e870b38 (diff)
vat2: add sanity checking - coverity errors
Type: fix Signed-off-by: Ole Troan <ot@cisco.com> Change-Id: I3cd56690fe52402d4cfa9ea67f1de53d8d919dee
-rw-r--r--MAINTAINERS5
-rw-r--r--src/tools/vppapigen/vppapigen_c.py9
2 files changed, 14 insertions, 0 deletions
diff --git a/MAINTAINERS b/MAINTAINERS
index 35bdaa33bcc..3f100e730f5 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -733,6 +733,11 @@ I: cjson
M: Ole Troan <ot@cisco.com>
F: src/vppinfra/cJSON.[ch]
+VAT2
+I: vat2
+M: Ole Troan <ot@cisco.com>
+F: src/vat2/
+
THE REST
I: misc
M: vpp-dev Mailing List <vpp-dev@fd.io>
diff --git a/src/tools/vppapigen/vppapigen_c.py b/src/tools/vppapigen/vppapigen_c.py
index a83d361010e..ba083499852 100644
--- a/src/tools/vppapigen/vppapigen_c.py
+++ b/src/tools/vppapigen/vppapigen_c.py
@@ -1534,6 +1534,7 @@ api_{n} (cJSON *o)
char *p;
int l;
vac_read(&p, &l, 5); // XXX: Fix timeout
+ if (p == 0 || l == 0) return 0;
// XXX Will fail in case of event received. Do loop
if (ntohs(*((u16 *)p)) != vac_get_msg_index(VL_API_{R}_CRC)) {{
fprintf(stderr, "Mismatched reply\\n");
@@ -1573,6 +1574,10 @@ api_{n} (cJSON *o)
char *p;
int l;
vac_read(&p, &l, 5); // XXX: Fix timeout
+ if (p == 0 || l == 0) {{
+ cJSON_free(reply);
+ return 0;
+ }}
/* Message can be one of [_details, control_ping_reply
* or unrelated event]
@@ -1583,6 +1588,10 @@ api_{n} (cJSON *o)
}}
if (reply_msg_id == details_msg_id) {{
+ if (l < sizeof(vl_api_{r}_t)) {{
+ cJSON_free(reply);
+ return 0;
+ }}
vl_api_{r}_t *rmp = (vl_api_{r}_t *)p;
vl_api_{r}_t_endian(rmp);
cJSON_AddItemToArray(reply, vl_api_{r}_t_tojson(rmp));