Don't check for a negative SRP extension size
authorMatt Caswell <matt@openssl.org>
Mon, 25 May 2015 23:05:28 +0000 (00:05 +0100)
committerMatt Caswell <matt@openssl.org>
Tue, 26 May 2015 09:42:10 +0000 (10:42 +0100)
The size of the SRP extension can never be negative (the variable
|size| is unsigned). Therefore don't check if it is less than zero.

RT#3862

Reviewed-by: Richard Levitte <levitte@openssl.org>
(cherry picked from commit 9c89d290834f3ed9146eeb8b64fe5de817679a0b)

ssl/t1_lib.c

index 1ad25078c1730712d4c45eae582d66a05c5515b0..36ea9b0a0951d59f42aef4f119b6991d22f5deef 100644 (file)
@@ -1134,7 +1134,7 @@ int ssl_parse_clienthello_tlsext(SSL *s, unsigned char **p, unsigned char *d,
         }
 # ifndef OPENSSL_NO_SRP
         else if (type == TLSEXT_TYPE_srp) {
-            if (size <= 0 || ((len = data[0])) != (size - 1)) {
+            if (size == 0 || ((len = data[0])) != (size - 1)) {
                 *al = SSL_AD_DECODE_ERROR;
                 return 0;
             }