BUG: Signing and encrypting a single space in textmode is broken

Werner Koch wk at gnupg.org
Mon Apr 22 10:13:02 CEST 2002

On Sat, 20 Apr 2002 20:18:55 -0400, David Shaw said:

> The problem seems to be in plaintext.c:handle_plaintext.  If you look
> at the if chain starting at line 117, it looks like this:

>   if(pt->len)
>     {
>       /* read pt->len bytes from the buffer and process them */
>     }
>   else if(!clearsig)
>     {
>       /* read all bytes from the buffer until end, and process them */

Argg.  I should know that one should better not use a special value as
a flag for a different thing (partial length encoded packets).

> The only thing this won't work with is if a GnuPG user signs a
> zero-length or stdin document with --rfc1991 set.  Since GnuPG doesn't

And with the old GnuPG-pre-OpenPGP partial length encoding.  But this
won't be a real problem - support for this should fade out anyway.

I think it will be cleaner to have an extra flag for partial length
encoded literal data packets instead of using the len == 0 and
new_ctb.  Setting it in parse_plaintext() and checking it instead of
!pt->len in handle_plaintext() should be simple enough for such a late
minute fix.


More information about the Gnupg-devel mailing list