Added OPENSSL_assert check as per PR#3377 reported by Rainer Jung <rainer.jung@kippda...
authorMatt Caswell <matt@openssl.org>
Thu, 12 Jun 2014 19:38:45 +0000 (20:38 +0100)
committerMatt Caswell <matt@openssl.org>
Thu, 12 Jun 2014 19:42:33 +0000 (20:42 +0100)
ssl/s3_pkt.c

index 22fb10d859bddd7c58e0d1386a91ff1e105ba2c6..fe46cb0b88f4c1e5d41aa421a15ad4f490df4991 100644 (file)
@@ -605,6 +605,7 @@ int ssl3_write_bytes(SSL *s, int type, const void *buf_, int len)
        int i;
 
        s->rwstate=SSL_NOTHING;
+       OPENSSL_assert(s->s3->wnum <= INT_MAX);
        tot=s->s3->wnum;
        s->s3->wnum=0;
 
@@ -628,7 +629,7 @@ int ssl3_write_bytes(SSL *s, int type, const void *buf_, int len)
         * buffer ... so we trap and report the error in a way the user
         * will notice
         */
-       if ( len < tot)
+       if (len < tot)
                {
                SSLerr(SSL_F_SSL3_WRITE_BYTES,SSL_R_BAD_LENGTH);
                return(-1);