[PATCH GnuPG 7/7] g10: fix uninit use
Sam James
sam at gentoo.org
Wed Jan 28 13:35:07 CET 2026
* g10/decrypt-data.c (aead_underflow): Initialize 'err'
to 0.
--
Just initialize to 0 and then there's no risk of using an uninit var
if we (somehow) fall through to the end label.
Found by GCC's -fanalyzer.
Signed-off-by: Sam James <sam at gentoo.org>
---
g10/decrypt-data.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/g10/decrypt-data.c b/g10/decrypt-data.c
index 0f1551144..8b1469257 100644
--- a/g10/decrypt-data.c
+++ b/g10/decrypt-data.c
@@ -638,7 +638,7 @@ static gpg_error_t
aead_underflow (decode_filter_ctx_t dfx, iobuf_t a, byte *buf, size_t *ret_len)
{
const size_t size = *ret_len; /* The allocated size of BUF. */
- gpg_error_t err;
+ gpg_error_t err = 0;
size_t totallen = 0; /* The number of bytes to return on success or EOF. */
size_t off = 0; /* The offset into the buffer. */
size_t len; /* The current number of bytes in BUF+OFF. */
--
2.52.0
More information about the Gnupg-devel
mailing list