From fed5b5525204a6892c936173d9336c479fa83941 Mon Sep 17 00:00:00 2001 From: Jonas Maebe Date: Mon, 9 Dec 2013 17:02:44 +0100 Subject: [PATCH] SSL_set_session: check for NULL after allocating s->kssl_ctx->client_princ Signed-off-by: Kurt Roeckx Reviewed-by: Matt Caswell --- ssl/ssl_sess.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/ssl/ssl_sess.c b/ssl/ssl_sess.c index 3bac2dbc69..a85f2792ce 100644 --- a/ssl/ssl_sess.c +++ b/ssl/ssl_sess.c @@ -792,6 +792,11 @@ int SSL_set_session(SSL *s, SSL_SESSION *session) session->krb5_client_princ_len > 0) { s->kssl_ctx->client_princ = (char *)OPENSSL_malloc(session->krb5_client_princ_len + 1); + if (s->kssl_ctx->client_princ == NULL) + { + SSLerr(SSL_F_SSL_SET_SESSION, ERR_R_MALLOC_FAILURE); + return(0); + } memcpy(s->kssl_ctx->client_princ,session->krb5_client_princ, session->krb5_client_princ_len); s->kssl_ctx->client_princ[session->krb5_client_princ_len] = '\0'; -- 2.40.0