aboutsummaryrefslogtreecommitdiffstats
path: root/src/vat2/jsonconvert.c
diff options
context:
space:
mode:
authorOle Troan <ot@cisco.com>2021-02-16 00:42:21 +0100
committerNeale Ranns <neale@graphiant.com>2021-02-16 09:15:15 +0000
commit5993a34a12cb41f83ced26893b977b4eb2947708 (patch)
tree665ef640ed63901dbb7946787c4399b4afbb3486 /src/vat2/jsonconvert.c
parent316967cfad2860ce286ef516d608d8099de7d9a9 (diff)
vppapigen: coveriy missing check of return values
Type: fix Signed-off-by: Ole Troan <ot@cisco.com> Change-Id: I424c2f283dab99c1856eb8d9a1444486d09e8e29
Diffstat (limited to 'src/vat2/jsonconvert.c')
-rw-r--r--src/vat2/jsonconvert.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/vat2/jsonconvert.c b/src/vat2/jsonconvert.c
index 35279eebb5f..fa41e7988e2 100644
--- a/src/vat2/jsonconvert.c
+++ b/src/vat2/jsonconvert.c
@@ -42,7 +42,8 @@ int vl_api_u8_string_fromjson(cJSON *o, u8 *s, int len)
unformat_input_t input;
char *p = cJSON_GetStringValue(o);
unformat_init_string (&input, p, strlen(p));
- unformat(&input, "0x%U", unformat_hex_string, s);
+ if (!unformat (&input, "0x%U", unformat_hex_string, s))
+ return -1;
return 0;
}
@@ -59,7 +60,8 @@ u8string_fromjson(cJSON *o, char *fieldname)
char *p = cJSON_GetStringValue(item);
unformat_init_string (&input, p, strlen(p));
- unformat(&input, "0x%U", unformat_hex_string, &s);
+ if (!unformat (&input, "0x%U", unformat_hex_string, &s))
+ return 0;
return s;
}