If a test group does not have expected key, it should not crash.
This patch fixes parsing test group info to continue further
when a key does not exist (as in asym tests).

Fixes: 58cc98801eb ("examples/fips_validation: add JSON parsing")

Signed-off-by: Gowrishankar Muthukrishnan <gmuthukri...@marvell.com>
Acked-by: Brian Dooley <brian.doo...@intel.com>
---
 examples/fips_validation/fips_validation.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/examples/fips_validation/fips_validation.c 
b/examples/fips_validation/fips_validation.c
index 6c9f5e42a4..06aeffe495 100644
--- a/examples/fips_validation/fips_validation.c
+++ b/examples/fips_validation/fips_validation.c
@@ -488,6 +488,9 @@ fips_test_parse_one_json_group(void)
                for (i = 0; info.interim_callbacks[i].key != NULL; i++) {
                        param = json_object_get(json_info.json_test_group,
                                        info.interim_callbacks[i].key);
+                       if (!param)
+                               continue;
+
                        switch (json_typeof(param)) {
                        case JSON_STRING:
                                snprintf(json_value, 256, "%s", 
json_string_value(param));
-- 
2.25.1

Reply via email to