g10: Fix possible null dereference.
authorNIIBE Yutaka <gniibe@fsij.org>
Tue, 14 May 2019 02:20:07 +0000 (11:20 +0900)
committerDaniel Kahn Gillmor <dkg@fifthhorseman.net>
Thu, 22 Aug 2019 19:11:59 +0000 (20:11 +0100)
* g10/armor.c (armor_filter): Access ->d in the internal loop.

--

Cherry-picked master commit of:
802a2aa300bad3d4385d17a2deeb0966da4e737d

GnuPG-bug-id: 4494
Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
(cherry picked from commit 5b22d2c400890fc366ccb7ca74ee886d9cef22a3)

Gbp-Pq: Topic from-2.2.16
Gbp-Pq: Name g10-Fix-possible-null-dereference.patch

g10/armor.c

index cc8096862343d76a839afbd1f528ef3853121c70..36215a33e7b4f94aca92f294091cbdcaa9d8dd80 100644 (file)
@@ -1156,10 +1156,10 @@ armor_filter( void *opaque, int control,
              }
 
            /* write the comment strings */
-           for(s=comment->d;comment;comment=comment->next,s=comment->d)
+           for(;comment;comment=comment->next)
              {
                iobuf_writestr(a, "Comment: " );
-               for( ; *s; s++ )
+               for( s=comment->d; *s; s++ )
                  {
                    if( *s == '\n' )
                      iobuf_writestr(a, "\\n" );