Bug in mimemaker.c found.

Werner Koch wk at gnupg.org
Mon May 9 20:58:29 CEST 2011

[Here is a message which didn't made it to the lists.]

-----Original Message-----
From: Paul Carmon [mailto:pdcarmon at msn.com] 
Sent: Saturday, April 23, 2011 12:14 PM
To: 'gnupg-devel at gnupg.org'
Subject: [gpgol] Bug in mimemaker.c found.

Dear Sirs:
   I believe that I have found a bug in mimemaker.c. This error appears to
be in both gpgol-1.0.1 and gpgol-1.1.2(the latest available).
Inside the function write_b64, you should remove the two lines that follow
(lines 370 and 371):
      if ((rc = write_buffer (sink, outbuf, 4)))
        return rc;
These lines cause corruption for most if not all datalen's that are not a
multiple of 3 bytes.
For me, this resulted in corrupted attachments to signed messages.
With these two lines removed, the data of interest should automatically be
written later by the lines that follow (lines 383 and 384):
      if ((rc = write_buffer (sink, outbuf, outlen)))
        return rc;
This appears to be a bug that was introduced with revision 281 of
mimemaker.c. It appears that these lines were overlooked in the transition
to code that attempts to reduce the number of calls to write_buffer.

Thank you,
Paul Carmon

More information about the Gnupg-devel mailing list