]> git.ipfire.org Git - thirdparty/openssl.git/commitdiff
Always return errors in ssl3_get_client_hello
authorDr. Stephen Henson <steve@openssl.org>
Tue, 9 Apr 2013 14:53:38 +0000 (15:53 +0100)
committerDr. Stephen Henson <steve@openssl.org>
Tue, 9 Apr 2013 14:59:47 +0000 (15:59 +0100)
If we successfully match a cookie don't set return value to 2 as this
results in other error conditions returning 2 as well.

Instead set return value to -2 which can be checked later if everything
else is OK.

ssl/s3_srvr.c

index 200f4951fb193825d3bbe5a58d5302d0e7ca49ff..d915155e15f8a2e01037dce0ee4ad3c22dcb322a 100644 (file)
@@ -1082,8 +1082,8 @@ int ssl3_get_client_hello(SSL *s)
                                                SSL_R_COOKIE_MISMATCH);
                                        goto f_err;
                                }
-
-                       ret = 2;
+                       /* Set to -2 so if successful we return 2 */
+                       ret = -2;
                        }
 
                p += cookie_len;
@@ -1461,7 +1461,7 @@ int ssl3_get_client_hello(SSL *s)
                        }
                }
 
-       if (ret < 0) ret=1;
+       if (ret < 0) ret=-ret;
        if (0)
                {
 f_err:
@@ -1469,7 +1469,7 @@ f_err:
                }
 err:
        if (ciphers != NULL) sk_SSL_CIPHER_free(ciphers);
-       return(ret);
+       return ret < 0 ? -1 : ret;
        }
 
 int ssl3_send_server_hello(SSL *s)