519fe2c
Fix for TLS record tampering bug. A carefully crafted invalid 
519fe2c
handshake could crash OpenSSL with a NULL pointer exception.
519fe2c
Thanks to Anton Johansson for reporting this issues.
519fe2c
(CVE-2013-4353)
519fe2c
diff --git a/ssl/s3_both.c b/ssl/s3_both.c
519fe2c
index 1e5dcab..53b9390 100644
519fe2c
--- a/ssl/s3_both.c
519fe2c
+++ b/ssl/s3_both.c
519fe2c
@@ -210,7 +210,11 @@ static void ssl3_take_mac(SSL *s)
519fe2c
 	{
519fe2c
 	const char *sender;
519fe2c
 	int slen;
519fe2c
-
519fe2c
+	/* If no new cipher setup return immediately: other functions will
519fe2c
+	 * set the appropriate error.
519fe2c
+	 */
519fe2c
+	if (s->s3->tmp.new_cipher == NULL)
519fe2c
+		return;
519fe2c
 	if (s->state & SSL_ST_CONNECT)
519fe2c
 		{
519fe2c
 		sender=s->method->ssl3_enc->server_finished_label;