[PATCH GnuPG 6/7] g10: fix uninit use

Sam James via Gnupg-devel <[email protected]> Wed, 28 Jan 2026 12:35:06 +0000
Newsgroups gmane.comp.encryption.gpg.devel
Message-ID <652fb3f4c332a694cf2303b8a7d9bb1d32771300.1769603707.git.sam@gentoo.org>
* g10/encrypt.c (reencrypt_to_new_recipients): Drop first
  (and uninitialized) use of 'count'.

--

In reencrypt_to_new_recipients, count isn't used in the first loop
and we later initialise it before another loop (where it is used), so
drop the first bogus use, as the increment was working w/ an uninit var
otherwise.

Found by GCC's -fanalyzer.

Signed-off-by: Sam James <[email protected]>
---
 g10/encrypt.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/g10/encrypt.c b/g10/encrypt.c
index b305ce938..19b2f7d13 100644
--- a/g10/encrypt.c
+++ b/g10/encrypt.c
@@ -1114,7 +1114,7 @@ reencrypt_to_new_recipients (ctrl_t ctrl, int armor, const char *filename,
    * recipient.  We can't do that for wildcards, though.  */
   if (!ctrl->clear_recipients)
     {
-      for (el = sesenc_list; el; el = el->next, count++)
+      for (el = sesenc_list; el; el = el->next)
         {
           if (el->u_sym)
             continue;
-- 
2.52.0