g10: Fix possible null dereference.
authorNIIBE Yutaka <gniibe@fsij.org>
Tue, 14 May 2019 02:20:07 +0000 (11:20 +0900)
committerNIIBE Yutaka <gniibe@fsij.org>
Tue, 14 May 2019 02:20:07 +0000 (11:20 +0900)
* g10/armor.c (armor_filter): Access ->d in the internal loop.

--

GnuPG-bug-id: 4494
Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
g10/armor.c

index 9727665..eb2d28b 100644 (file)
@@ -1394,10 +1394,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" );