summaryrefslogtreecommitdiffstats
path: root/ssl
diff options
context:
space:
mode:
authorBernd Edlinger <bernd.edlinger@hotmail.de>2018-02-09 19:31:36 +0100
committerBernd Edlinger <bernd.edlinger@hotmail.de>2018-02-09 19:31:36 +0100
commit575c69f97ca7c8cfaf2a448272f7a1615308acdd (patch)
tree4dd08ef8fb15994b0bd5161df2ee5f2af3ed72fd /ssl
parent48081cf988fc8f50215a2b18babd6a7859defd36 (diff)
Swap the check in ssl3_write_pending to avoid using
the possibly indeterminate pointer value in wpend_buf. Reviewed-by: Matt Caswell <matt@openssl.org> (Merged from https://github.com/openssl/openssl/pull/5309)
Diffstat (limited to 'ssl')
-rw-r--r--ssl/s3_pkt.c5
1 files changed, 2 insertions, 3 deletions
diff --git a/ssl/s3_pkt.c b/ssl/s3_pkt.c
index d74a91d668..c79a5077d9 100644
--- a/ssl/s3_pkt.c
+++ b/ssl/s3_pkt.c
@@ -1096,10 +1096,9 @@ int ssl3_write_pending(SSL *s, int type, const unsigned char *buf,
int i;
SSL3_BUFFER *wb = &(s->s3->wbuf);
-/* XXXX */
if ((s->s3->wpend_tot > (int)len)
- || ((s->s3->wpend_buf != buf) &&
- !(s->mode & SSL_MODE_ACCEPT_MOVING_WRITE_BUFFER))
+ || (!(s->mode & SSL_MODE_ACCEPT_MOVING_WRITE_BUFFER)
+ && (s->s3->wpend_buf != buf))
|| (s->s3->wpend_type != type)) {
SSLerr(SSL_F_SSL3_WRITE_PENDING, SSL_R_BAD_WRITE_RETRY);
return (-1);