multifile, textmode and sign buglet

David Shaw dshaw at
Thu Feb 13 03:28:01 CET 2003

On Thu, Feb 13, 2003 at 12:50:07AM +0100, Marcus Brinkmann wrote:
> Hi,
> in g10/sign.c:sign_file(), INP is only opened early on if only a single file
> is signed, but a text_filter is pushed unconditionally on it.
>     if( opt.textmode && !outfile)
>         iobuf_push_filter( inp, text_filter, &tfx );
> I am a bit unsure what the right fix is.  The check necessary would be of
> course && !multifile, but I don't know if !outfile is correct or should be
> replaced (outfile seems to be to control the output, I don't see the
> connection to inp, but I might miss something).

outfile is actually not currently used for anything.  If you check all
calls to sign_file(), you'll see it is always NULL.  The proper check
is !outfile && !multifile.  I guess nobody tried to detach sign
multiple textmode files before... segfault from that bug.

There is actually another bug hidden by the first one: multiple
detached textmode signatures were marked as textmode, but hashed as
binary.  This doesn't matter most of the time, but if one of the text
files has whitespace at the end of the line...

Anyway, great catch!  I'll have a fix in soon.


   David Shaw  |  dshaw at  |  WWW
   "There are two major products that come out of Berkeley: LSD and UNIX.
      We don't believe this to be a coincidence." - Jeremy S. Anderson

More information about the Gnupg-devel mailing list