mirror of
git://git.gnupg.org/gnupg.git
synced 2025-01-10 13:04:23 +01:00
(write_plaintext_packet): Fixed the detection of too
large files in the same way as in encode.c.
This commit is contained in:
parent
f106448a7d
commit
135946bb02
@ -1,3 +1,8 @@
|
|||||||
|
2004-05-07 Werner Koch <wk@gnupg.org>
|
||||||
|
|
||||||
|
* sign.c (write_plaintext_packet): Fixed the detection of too
|
||||||
|
large files in the same way as in encode.c.
|
||||||
|
|
||||||
2004-05-04 David Shaw <dshaw@jabberwocky.com>
|
2004-05-04 David Shaw <dshaw@jabberwocky.com>
|
||||||
|
|
||||||
* keylist.c (show_notation): Use bits to select which sort of
|
* keylist.c (show_notation): Use bits to select which sort of
|
||||||
|
21
g10/sign.c
21
g10/sign.c
@ -544,19 +544,24 @@ write_plaintext_packet (IOBUF out, IOBUF inp, const char *fname, int ptmode)
|
|||||||
|
|
||||||
/* try to calculate the length of the data */
|
/* try to calculate the length of the data */
|
||||||
if (fname && *fname && !(*fname=='-' && !fname[1])) {
|
if (fname && *fname && !(*fname=='-' && !fname[1])) {
|
||||||
if( !(filesize = iobuf_get_filelength(inp)) )
|
off_t tmpsize;
|
||||||
|
|
||||||
|
if( !(tmpsize = iobuf_get_filelength(inp)) )
|
||||||
log_info (_("WARNING: `%s' is an empty file\n"), fname);
|
log_info (_("WARNING: `%s' is an empty file\n"), fname);
|
||||||
|
|
||||||
/* we can't yet encode the length of very large files,
|
/* We can't encode the length of very large files because
|
||||||
* so we switch to partial length encoding in this case */
|
OpenPGP uses only 32 bit for file sizes. So if the size of
|
||||||
if (filesize >= IOBUF_FILELENGTH_LIMIT)
|
a file is larger than 2^32 minus some bytes for packet
|
||||||
filesize = 0;
|
headers, we switch to partial length encoding. */
|
||||||
|
if ( tmpsize < (IOBUF_FILELENGTH_LIMIT - 65536) )
|
||||||
|
filesize = tmpsize;
|
||||||
|
else
|
||||||
|
filesize = 0;
|
||||||
|
|
||||||
/* because the text_filter modifies the length of the
|
/* Because the text_filter modifies the length of the
|
||||||
* data, it is not possible to know the used length
|
* data, it is not possible to know the used length
|
||||||
* without a double read of the file - to avoid that
|
* without a double read of the file - to avoid that
|
||||||
* we simple use partial length packets.
|
* we simple use partial length packets. */
|
||||||
*/
|
|
||||||
if ( ptmode == 't' )
|
if ( ptmode == 't' )
|
||||||
filesize = 0;
|
filesize = 0;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user