From 57f3527799b339a331a0639d604f2f1e015d109e Mon Sep 17 00:00:00 2001 From: Ingo Franzki Date: Tue, 24 May 2022 08:49:23 +0200 Subject: [PATCH] libkmipclient: Fix -Wmaybe-uninitialized warning with gcc 12 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Gcc 12 produces a -Wmaybe-uninitialized warning that the content of the tmp buffer may be uninitialized. This is a false positive. Silence the warning by using calloc instead of malloc to ensure that the allocated buffer is initialized. Signed-off-by: Ingo Franzki Reviewed-by: Jan Höppner Signed-off-by: Jan Höppner --- libkmipclient/utils.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libkmipclient/utils.c b/libkmipclient/utils.c index dbd03fd9..ef70c453 100644 --- a/libkmipclient/utils.c +++ b/libkmipclient/utils.c @@ -259,7 +259,7 @@ int kmip_decode_bignum(const unsigned char *data, uint32_t length, BIGNUM **bn) if (data[0] & 0x80) { neg = 1; - tmp = malloc(length); + tmp = calloc(1, length); if (tmp == NULL) return -ENOMEM;