Fix a compression bug

do_ssl3_write() was crashing when compression was enabled. We calculate
the maximum length that a record will be after compression and reserve
those bytes in the WPACKET. Unfortunately we were adding the maximum
compression overhead onto the wrong variable resulting in a corrupted
record.

Reviewed-by: Rich Salz <rsalz@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/2814)
This commit is contained in:
Matt Caswell 2017-03-01 11:20:30 +00:00
parent c19602b543
commit f33f9ddefb

View File

@ -791,7 +791,7 @@ int do_ssl3_write(SSL *s, int type, const unsigned char *buf,
maxcomplen = pipelens[j];
if (s->compress != NULL)
pipelens[j] += SSL3_RT_MAX_COMPRESSED_OVERHEAD;
maxcomplen += SSL3_RT_MAX_COMPRESSED_OVERHEAD;
/* write the header */
if (!WPACKET_put_bytes_u8(thispkt, rectype)