From 078850cdd57f737e46ad383b9b0f7cb1d032feef Mon Sep 17 00:00:00 2001 From: Loup Vaillant Date: Sun, 28 Jan 2018 23:51:43 +0100 Subject: [PATCH] Fixed buffer overflow (wipe too big) --- src/monocypher.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/monocypher.c b/src/monocypher.c index 1f2fcd8..8e0b27b 100644 --- a/src/monocypher.c +++ b/src/monocypher.c @@ -1791,11 +1791,11 @@ int crypto_aead_unlock(u8 *plain_text, crypto_lock_auth(&ctx, cipher_text, text_size); crypto_chacha_ctx chacha_ctx = ctx.chacha; // avoid the wiping... if (crypto_unlock_final(&ctx, mac)) { // ...that occurs here - crypto_wipe(&chacha_ctx, sizeof(ctx)); + crypto_wipe(&chacha_ctx, sizeof(chacha_ctx)); return -1; // reject forgeries before wasting our time decrypting } crypto_chacha20_encrypt(&chacha_ctx, plain_text, cipher_text, text_size); - crypto_wipe(&chacha_ctx, sizeof(ctx)); + crypto_wipe(&chacha_ctx, sizeof(chacha_ctx)); return 0; } -- 2.47.3