a few GPGME issues

Marcus Brinkmann Marcus.Brinkmann at ruhr-uni-bochum.de
Mon Apr 22 14:26:02 CEST 2002

On Mon, Apr 22, 2002 at 08:54:04AM +0200, Werner Koch wrote:
> > Bugger, that means that for now I'm going to have to resort to calling
> > gnupg and using the command-fd and passphrase-fd stuff myself :(

Well, I think it's a bug.

> Marcus, please check whether it really copies the passphrase data.
> IIRC, I made it writing directly to the fd.  But well, quite some time
> passed since I implemented it.

Yeah, I spent a bit of time finding my way through the level of

The passphrase.c command_handler function calls the passphrase_cb and
returns the string without copying.  But the command_cb function in rungpg.c
first just stores the pointer into VALUE, and calculates its length.

And then it copies the data:

    memcpy ( buffer, value, value_len );

Line 1205.  It also makes sure that it is newline terminated.  Then it will
make the caller clean up the resources before it returns, which forces us to
copy the value (because we can not rely on the user contributed string to
still exist after we have called for clean up).

This should really be fixed.


`Rhubarb is no Egyptian god.' Debian http://www.debian.org brinkmd at debian.org
Marcus Brinkmann              GNU    http://www.gnu.org    marcus at gnu.org
Marcus.Brinkmann at ruhr-uni-bochum.de

More information about the Gnupg-devel mailing list