From ea83a273716932bf02a06dd988729fb64f80e207 Mon Sep 17 00:00:00 2001 From: Jakub Jelen Date: Mon, 31 Jan 2022 13:38:32 +0100 Subject: [PATCH] libcrypto: Initialize returning size_t value This prevents the usage of uninitialized value on error in the known hosts hasing code if invalid (empty) hostname is used. Signed-off-by: Jakub Jelen Reviewed-by: Andreas Schneider Reviewed-by: Sahana Prasad --- src/libcrypto.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/libcrypto.c b/src/libcrypto.c index e94ee9ab..ea372cb8 100644 --- a/src/libcrypto.c +++ b/src/libcrypto.c @@ -468,7 +468,7 @@ void hmac_update(HMACCTX ctx, const void *data, unsigned long len) void hmac_final(HMACCTX ctx, unsigned char *hashmacbuf, unsigned int *len) { - size_t res; + size_t res = 0; EVP_DigestSignFinal(ctx, hashmacbuf, &res); EVP_MD_CTX_free(ctx); *len = res;