Browse Source

Return immediately if a cipher command is invalid.

Breaking from inside the inner loop doesn't do what the code wants.
Instead the outer loop will continue running and it's possible for it to
read off the end of the buffer. (Found with libFuzzer.)

Next change will update the other abort points in this code to match.

Change-Id: I006dca0cd4c31db1c4b5e84b996fe24b2f1e6c13
Reviewed-on: https://boringssl-review.googlesource.com/11421
Reviewed-by: David Benjamin <davidben@google.com>
Commit-Queue: David Benjamin <davidben@google.com>
CQ-Verified: CQ bot account: commit-bot@chromium.org <commit-bot@chromium.org>
kris/onging/CECPQ3_patch15
Adam Langley 8 years ago
committed by CQ bot account: commit-bot@chromium.org
parent
commit
f99f2448bd
2 changed files with 3 additions and 3 deletions
  1. +1
    -3
      ssl/ssl_cipher.c
  2. +2
    -0
      ssl/ssl_test.cc

+ 1
- 3
ssl/ssl_cipher.c View File

@@ -1277,9 +1277,7 @@ static int ssl_cipher_process_rulestr(const SSL_PROTOCOL_METHOD *ssl_method,
/* We hit something we cannot deal with, it is no command or separator
* nor alphanumeric, so we call this an error. */
OPENSSL_PUT_ERROR(SSL, SSL_R_INVALID_COMMAND);
retval = in_group = 0;
l++;
break;
return 0;
}

if (rule == CIPHER_SPECIAL) {


+ 2
- 0
ssl/ssl_test.cc View File

@@ -252,6 +252,8 @@ static const char *kBadRules[] = {
"[ECDHE-RSA-CHACHA20-POLY1305|ECDHE-RSA-AES128-GCM-SHA256]:!FOO",
"[ECDHE-RSA-CHACHA20-POLY1305|ECDHE-RSA-AES128-GCM-SHA256]:-FOO",
"[ECDHE-RSA-CHACHA20-POLY1305|ECDHE-RSA-AES128-GCM-SHA256]:@STRENGTH",
// Opcode supplied, but missing selector.
"+",
};

static const char *kMustNotIncludeNull[] = {


Loading…
Cancel
Save