Dereferencing a pointer that might be null key_token when calling strstr.
Check if the pointer is null before.

Coverity issue: 141071
Fixes: f8be1786b1b8 ("app/crypto-perf: introduce performance test application")

Signed-off-by: Slawomir Mrozowicz <slawomirx.mrozow...@intel.com>
---
 app/test-crypto-perf/cperf_test_vector_parsing.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/app/test-crypto-perf/cperf_test_vector_parsing.c 
b/app/test-crypto-perf/cperf_test_vector_parsing.c
index e0bcb20..a7d7b51 100644
--- a/app/test-crypto-perf/cperf_test_vector_parsing.c
+++ b/app/test-crypto-perf/cperf_test_vector_parsing.c
@@ -240,7 +240,7 @@ parse_entry(char *entry, struct cperf_test_vector *vector,
 
        /* get values for key */
        token = strtok(NULL, CPERF_ENTRY_DELIMITER);
-       if (token == NULL) {
+       if (key_token == NULL || token == NULL) {
                printf("Expected 'key = values' but was '%.40s'..\n",
                        key_token);
                return -1;
-- 
2.5.0

Reply via email to