]> granicus.if.org Git - openssl/commitdiff
Swap the check in ssl3_write_pending to avoid using
authorBernd Edlinger <bernd.edlinger@hotmail.de>
Fri, 9 Feb 2018 18:31:36 +0000 (19:31 +0100)
committerBernd Edlinger <bernd.edlinger@hotmail.de>
Fri, 9 Feb 2018 18:31:36 +0000 (19:31 +0100)
the possibly indeterminate pointer value in wpend_buf.

Reviewed-by: Matt Caswell <matt@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/5309)

ssl/s3_pkt.c

index d74a91d668528f3bbfffdf7da28a366773ada56c..c79a5077d9a89ca87c325bf34725ae080a5beeeb 100644 (file)
@@ -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);