pull in upstream rev.22547:

Sanity check record length before skipping explicit IV in TLS 1.2, 1.1
and DTLS to fix DoS attack.
(CVE-2012-2333)
This commit is contained in:
drochner 2012-05-11 18:07:33 +00:00
parent 3956fa9ae1
commit 4c2e6ed1da
2 changed files with 3 additions and 1 deletions

View File

@ -260,7 +260,7 @@ int dtls1_enc(SSL *s, int send)
}
/* TLS 1.0 does not bound the number of padding bytes by the block size.
* All of them must have value 'padding_length'. */
if (i > (int)rec->length)
if (i + bs > (int)rec->length)
{
/* Incorrect padding. SSLerr() and ssl3_alert are done
* by caller: we don't want to reveal whether this is

View File

@ -823,6 +823,8 @@ int tls1_enc(SSL *s, int send)
if (s->version >= TLS1_1_VERSION
&& EVP_CIPHER_CTX_mode(ds) == EVP_CIPH_CBC_MODE)
{
if (bs > (int)rec->length)
return -1;
rec->data += bs; /* skip the explicit IV */
rec->input += bs;
rec->length -= bs;