Enforce NULL data for empty digest input 52/76352/1
authorKrzysztof Jackiewicz <k.jackiewicz@samsung.com>
Thu, 23 Jun 2016 12:15:36 +0000 (14:15 +0200)
committerKrzysztof Jackiewicz <k.jackiewicz@samsung.com>
Thu, 23 Jun 2016 12:15:36 +0000 (14:15 +0200)
Change-Id: I7fbd82b9aea2c9c2b712d72e09ac014d2dcf6a2f

src/simple.c

index a621281..f8f5537 100644 (file)
@@ -44,7 +44,8 @@ API int yaca_simple_calculate_digest(yaca_digest_algorithm_e algo,
        char *ldigest = NULL;
        size_t ldigest_len;
 
-       if ((data == NULL && data_len > 0) || digest == NULL || digest_len == NULL)
+       if ((data == NULL && data_len > 0) || (data != NULL && data_len == 0) ||
+           digest == NULL || digest_len == NULL)
                return YACA_ERROR_INVALID_PARAMETER;
 
        ret = yaca_digest_initialize(&ctx, algo);