From: Krzysztof Jackiewicz Date: Wed, 15 Jun 2016 15:32:31 +0000 (+0200) Subject: Make sure output length argument is not NULL X-Git-Tag: accepted/tizen/common/20160810.161523~46 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=f2b88dbd1879cc6dde334a759d696178e5147532;p=platform%2Fcore%2Fsecurity%2Fyaca.git Make sure output length argument is not NULL Change-Id: I2ed584063314213efba934b282f603ce49f69899 --- diff --git a/src/crypto.c b/src/crypto.c index 6acdc2a..40f6a99 100644 --- a/src/crypto.c +++ b/src/crypto.c @@ -291,7 +291,7 @@ API int yaca_context_destroy(yaca_context_h ctx) API int yaca_context_get_output_length(const yaca_context_h ctx, size_t input_len, size_t *output_len) { - if (ctx == YACA_CONTEXT_NULL) + if (ctx == YACA_CONTEXT_NULL || output_len == NULL) return YACA_ERROR_INVALID_PARAMETER; return ctx->get_output_length(ctx, input_len, output_len); diff --git a/src/digest.c b/src/digest.c index 235a0a2..64b88f4 100644 --- a/src/digest.c +++ b/src/digest.c @@ -54,6 +54,8 @@ static int get_digest_output_length(const yaca_context_h ctx, UNUSED size_t input_len, size_t *output_len) { + assert(output_len != NULL); + struct yaca_digest_ctx_s *c = get_digest_ctx(ctx); if (c == NULL) diff --git a/src/encrypt.c b/src/encrypt.c index 7a01f33..5942e2e 100644 --- a/src/encrypt.c +++ b/src/encrypt.c @@ -59,6 +59,8 @@ void destroy_encrypt_context(const yaca_context_h ctx) int get_encrypt_output_length(const yaca_context_h ctx, size_t input_len, size_t *output_len) { + assert(output_len != NULL); + struct yaca_encrypt_context_s *nc = get_encrypt_context(ctx); int block_size; diff --git a/src/sign.c b/src/sign.c index 7be2005..98543e0 100644 --- a/src/sign.c +++ b/src/sign.c @@ -67,6 +67,8 @@ static int get_sign_output_length(const yaca_context_h ctx, UNUSED size_t input_len, size_t *output_len) { + assert(output_len != NULL); + struct yaca_sign_ctx_s *c = get_sign_ctx(ctx); if (c == NULL)