From: Rich Salz Date: Tue, 11 Apr 2017 16:17:54 +0000 (-0400) Subject: Additional check to handle BAD SSL_write retry X-Git-Tag: OpenSSL_1_0_2l~20 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=71d66c46c725a88a8d14b747610656e15610109e;p=oweals%2Fopenssl.git Additional check to handle BAD SSL_write retry Reviewed-by: Matt Caswell Reviewed-by: Rich Salz (Merged from https://github.com/openssl/openssl/pull/3122) --- diff --git a/ssl/s3_pkt.c b/ssl/s3_pkt.c index 39cdbaf898..0290c991d8 100644 --- a/ssl/s3_pkt.c +++ b/ssl/s3_pkt.c @@ -670,7 +670,7 @@ int ssl3_write_bytes(SSL *s, int type, const void *buf_, int len) * promptly send beyond the end of the users buffer ... so we trap and * report the error in a way the user will notice */ - if (len < tot) { + if ((len < tot) || ((wb->left != 0) && (len < (tot + s->s3->wpend_tot)))) { SSLerr(SSL_F_SSL3_WRITE_BYTES, SSL_R_BAD_LENGTH); return (-1); }