BUG: gpg 1.4.9 opens --attribute-file in text mode

Adam M. adam at adammil.net
Wed Jul 2 01:12:15 CEST 2008


On the official Windows build of GPG 1.4.9 available from www.gnupg.org, 
GPG opens the --attribute-file in text mode, causing all LF characters 
to be converted to CR LF. Since the attribute data is binary, this 
corrupts it.

This also seems to happen with --attribute-fd, at least if the file 
descriptor is 2.

I looked in the source, and the --attribute-file is opened with 
gpg.c:open_info_file(), which doesn't specify O_BINARY if for_write is 
true (which it is in this case).

The --attribute-fd is opened with iobuf.c:iobuf_translate_file_handle(), 
which also doesn't specify O_BINARY.

I would add a 'binary' (or 'text') parameter to these two functions and 
then add the O_BINARY or O_TEXT flags appropriately.

-- Adam M.



More information about the Gnupg-devel mailing list