diff options
Diffstat (limited to 'ssl/s3_clnt.c')
| -rw-r--r-- | ssl/s3_clnt.c | 34 | 
1 files changed, 15 insertions, 19 deletions
diff --git a/ssl/s3_clnt.c b/ssl/s3_clnt.c index 19dc8648b952..218534734dd7 100644 --- a/ssl/s3_clnt.c +++ b/ssl/s3_clnt.c @@ -1216,6 +1216,12 @@ int ssl3_get_server_certificate(SSL *s)          goto f_err;      }      for (nc = 0; nc < llen;) { +        if (nc + 3 > llen) { +            al = SSL_AD_DECODE_ERROR; +            SSLerr(SSL_F_SSL3_GET_SERVER_CERTIFICATE, +                   SSL_R_CERT_LENGTH_MISMATCH); +            goto f_err; +        }          n2l3(p, l);          if ((l + nc + 3) > llen) {              al = SSL_AD_DECODE_ERROR; @@ -2111,6 +2117,10 @@ int ssl3_get_certificate_request(SSL *s)      if (ctype_num > SSL3_CT_NUMBER) {          /* If we exceed static buffer copy all to cert structure */          s->cert->ctypes = OPENSSL_malloc(ctype_num); +        if (s->cert->ctypes == NULL) { +            SSLerr(SSL_F_SSL3_GET_CERTIFICATE_REQUEST, ERR_R_MALLOC_FAILURE); +            goto err; +        }          memcpy(s->cert->ctypes, p, ctype_num);          s->cert->ctype_num = (size_t)ctype_num;          ctype_num = SSL3_CT_NUMBER; @@ -2167,6 +2177,11 @@ int ssl3_get_certificate_request(SSL *s)      }      for (nc = 0; nc < llen;) { +        if (nc + 2 > llen) { +            ssl3_send_alert(s, SSL3_AL_FATAL, SSL_AD_DECODE_ERROR); +            SSLerr(SSL_F_SSL3_GET_CERTIFICATE_REQUEST, SSL_R_CA_DN_TOO_LONG); +            goto err; +        }          n2s(p, l);          if ((l + nc + 2) > llen) {              if ((s->options & SSL_OP_NETSCAPE_CA_DN_BUG)) @@ -2999,19 +3014,6 @@ int ssl3_send_client_key_exchange(SSL *s)                  goto err;              }              /* -             * If we have client certificate, use its secret as peer key -             */ -            if (s->s3->tmp.cert_req && s->cert->key->privatekey) { -                if (EVP_PKEY_derive_set_peer -                    (pkey_ctx, s->cert->key->privatekey) <= 0) { -                    /* -                     * If there was an error - just ignore it. Ephemeral key -                     * * would be used -                     */ -                    ERR_clear_error(); -                } -            } -            /*               * Compute shared IV and store it in algorithm-specific context               * data               */ @@ -3057,12 +3059,6 @@ int ssl3_send_client_key_exchange(SSL *s)                  n = msglen + 2;              }              memcpy(p, tmp, msglen); -            /* Check if pubkey from client certificate was used */ -            if (EVP_PKEY_CTX_ctrl -                (pkey_ctx, -1, -1, EVP_PKEY_CTRL_PEER_KEY, 2, NULL) > 0) { -                /* Set flag "skip certificate verify" */ -                s->s3->flags |= TLS1_FLAGS_SKIP_CERT_VERIFY; -            }              EVP_PKEY_CTX_free(pkey_ctx);              s->session->master_key_length =                  s->method->ssl3_enc->generate_master_secret(s,  | 
