[PATCH GnuPG 7/7] g10: fix uninit use
Sam James via Gnupg-devel <[email protected]> Wed, 28 Jan 2026 12:35:07 +0000
| Newsgroups | gmane.comp.encryption.gpg.devel |
|---|---|
| Message-ID | <00e58c60b4f01f944b91356247931f2b2f4d2c46.1769603707.git.sam@gentoo.org> |
* 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 <[email protected]> --- 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