Correct pointer to be freed
authorRichard Levitte <levitte@openssl.org>
Sat, 28 Jan 2017 14:14:07 +0000 (15:14 +0100)
committerRichard Levitte <levitte@openssl.org>
Sat, 28 Jan 2017 14:14:07 +0000 (15:14 +0100)
The pointer that was freed in the SSLv2 section of ssl_bytes_to_cipher_list
may have stepped up from its allocated position.  Use a pointer that is
guaranteed to point at the start of the allocated block instead.

Reviewed-by: Kurt Roeckx <kurt@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/2312)

ssl/statem/statem_srvr.c

index 0043b05dac5f214a80fc1925cf8c5f721989b154..2e76b80b8647296d1de67d8247d82ca542893417 100644 (file)
@@ -3489,7 +3489,7 @@ STACK_OF(SSL_CIPHER) *ssl_bytes_to_cipher_list(SSL *s,
                     || (leadbyte != 0
                         && !PACKET_forward(&sslv2ciphers, TLS_CIPHER_LEN))) {
                 *al = SSL_AD_INTERNAL_ERROR;
-                OPENSSL_free(raw);
+                OPENSSL_free(s->s3->tmp.ciphers_raw);
                 s->s3->tmp.ciphers_raw = NULL;
                 s->s3->tmp.ciphers_rawlen = 0;
                 goto err;