From 1c70d409ad1e10be0449ee50ba450e8c4d4dbfef Mon Sep 17 00:00:00 2001
From: Paul Bakker
Date: Sun, 4 Dec 2011 22:30:17 +0000
Subject: [PATCH] - Added better handling of missing session struct
---
library/ssl_srv.c | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/library/ssl_srv.c b/library/ssl_srv.c
index 57de3b18b..5f2891db2 100644
--- a/library/ssl_srv.c
+++ b/library/ssl_srv.c
@@ -415,6 +415,12 @@ static int ssl_write_server_hello( ssl_context *ssl )
ssl->resume = 0;
ssl->state++;
+ if( ssl->session == NULL )
+ {
+ SSL_DEBUG_MSG( 1, ( "No session struct set" ) );
+ return( POLARSSL_ERR_SSL_BAD_INPUT_DATA );
+ }
+
if( ( ret = ssl->f_rng( ssl->p_rng, ssl->session->id, n ) ) != 0 )
return( ret );
}