Skip to content

Commit

Permalink
Additional check to handle BAD SSL_write retry
Browse files Browse the repository at this point in the history
Reviewed-by: Matt Caswell <matt@openssl.org>
Reviewed-by: Rich Salz <rsalz@openssl.org>
(Merged from openssl#3124)
  • Loading branch information
Rich Salz committed Apr 11, 2017
1 parent 0856e3f commit cbbe918
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion ssl/record/rec_layer_s3.c
Original file line number Diff line number Diff line change
Expand Up @@ -356,7 +356,8 @@ int ssl3_write_bytes(SSL *s, int type, const void *buf_, size_t 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 < s->rlayer.wnum) {
if ((len < s->rlayer.wnum)
|| ((wb->left != 0) && (len < (s->rlayer.wnum + s->rlayer.wpend_tot)))) {
SSLerr(SSL_F_SSL3_WRITE_BYTES, SSL_R_BAD_LENGTH);
return -1;
}
Expand Down

0 comments on commit cbbe918

Please sign in to comment.