Don't infinite loop on garbage server input.

else block got lost in a rewrite of this code.

Change-Id: I51f1655474ec8bbd4eccb4297124e8584329444e
Reviewed-on: https://boringssl-review.googlesource.com/2560
Reviewed-by: Adam Langley <agl@google.com>
This commit is contained in:
David Benjamin 2014-12-11 18:48:59 -05:00 committed by Adam Langley
parent 226a872d2f
commit f080ecd86d
2 changed files with 12 additions and 0 deletions

View File

@ -381,6 +381,11 @@ static int ssl23_get_client_hello(SSL *s)
/* Ready to switch versions. */ /* Ready to switch versions. */
s->state = SSL23_ST_SR_SWITCH_VERSION; s->state = SSL23_ST_SR_SWITCH_VERSION;
} }
else
{
OPENSSL_PUT_ERROR(SSL, ssl23_get_client_hello, SSL_R_UNKNOWN_PROTOCOL);
goto err;
}
return 1; return 1;
err: err:

View File

@ -514,6 +514,13 @@ var testCases = []testCase{
shouldFail: true, shouldFail: true,
expectedError: ":HTTPS_PROXY_REQUEST:", expectedError: ":HTTPS_PROXY_REQUEST:",
}, },
{
testType: serverTest,
name: "Garbage",
sendPrefix: "blah",
shouldFail: true,
expectedError: ":UNKNOWN_PROTOCOL:",
},
{ {
name: "SkipCipherVersionCheck", name: "SkipCipherVersionCheck",
config: Config{ config: Config{