Mailing List Archive

[PATCH 2/3] md: clear context with wipememory to avoid false warning
* cipher/md.c (md_open): Initialize ctx with wipememory2 instead
of memset.
--

GCC 11 gives warning on use of memset:
warning: '__builtin_memset' offset [0, 19] is out of the bounds [0, 0] [-Warray-bounds]

Signed-off-by: Jussi Kivilinna <jussi.kivilinna@iki.fi>
---
cipher/md.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/cipher/md.c b/cipher/md.c
index 428959b2..64dc235a 100644
--- a/cipher/md.c
+++ b/cipher/md.c
@@ -493,7 +493,7 @@ md_open (gcry_md_hd_t *h, int algo, unsigned int flags)
hd->bufpos = 0;

/* Initialize the private data. */
- memset (ctx, 0, sizeof *ctx);
+ wipememory2 (ctx, 0, sizeof *ctx);
ctx->magic = secure ? CTX_MAGIC_SECURE : CTX_MAGIC_NORMAL;
ctx->actual_handle_size = n + sizeof (struct gcry_md_context);
ctx->flags.secure = secure;
--
2.32.0


_______________________________________________
Gcrypt-devel mailing list
Gcrypt-devel@gnupg.org
http://lists.gnupg.org/mailman/listinfo/gcrypt-devel