Don't use FORMAT_BASE64 format when compressing / decompressing

When compressing, the output / input is a binary format, not a text
format like BASE64.  This is important on Windows, where a ^Z in a
text file is seen as EOF, and there could be a ^Z somewhere in a
compressed file, cutting it short as input.

Reviewed-by: Matt Caswell <matt@openssl.org>
This commit is contained in:
Richard Levitte 2016-04-13 02:40:39 +02:00
parent da430a5555
commit 802d224308
1 changed files with 9 additions and 6 deletions

View File

@ -313,12 +313,15 @@ int enc_main(int argc, char **argv)
if (verbose) if (verbose)
BIO_printf(bio_err, "bufsize=%d\n", bsize); BIO_printf(bio_err, "bufsize=%d\n", bsize);
if (base64) { #ifdef ZLIB
if (enc) if (!do_zlib)
outformat = FORMAT_BASE64; #endif
else if (base64) {
informat = FORMAT_BASE64; if (enc)
} outformat = FORMAT_BASE64;
else
informat = FORMAT_BASE64;
}
strbuf = app_malloc(SIZE, "strbuf"); strbuf = app_malloc(SIZE, "strbuf");
buff = app_malloc(EVP_ENCODE_LENGTH(bsize), "evp buffer"); buff = app_malloc(EVP_ENCODE_LENGTH(bsize), "evp buffer");