examples/fips_validation: fix null dereferences
[dpdk.git] / examples / fips_validation / fips_validation_tdes.c
index 5064ff3..2b262c9 100644 (file)
@@ -202,7 +202,7 @@ parse_test_tdes_writeback(struct fips_val *val)
 static int
 writeback_tdes_hex_str(const char *key, char *dst, struct fips_val *val)
 {
-       struct fips_val tmp_val;
+       struct fips_val tmp_val = {0};
 
        tmp_val.len = 8;
 
@@ -212,6 +212,8 @@ writeback_tdes_hex_str(const char *key, char *dst, struct fips_val *val)
                tmp_val.val = val->val + 8;
        else if (strstr(key, KEY3_STR))
                tmp_val.val = val->val + 16;
+       else
+               return -EINVAL;
 
        return writeback_hex_str(key, dst, &tmp_val);
 }