summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatt Caswell <matt@openssl.org>2014-03-18 14:19:22 +0000
committerMatt Caswell <matt@openssl.org>2014-12-15 21:26:56 +0000
commitce5ddefc4394a0ae6c79efaffe08cf47ac659ea0 (patch)
treeeac6007eda564666e6c76bb1cab09890bd9c2216
parent458f23f61021da8badf2457db0608232b3c8bec4 (diff)
Check return value of ssl3_output_cert_chain
Based on commit 66f96fe2d519147097c118d4bf60704c69ed0635 by Steve Henson Reviewed-by: Tim Hudson <tjh@openssl.org>
-rw-r--r--ssl/s3_clnt.c6
-rw-r--r--ssl/s3_srvr.c5
2 files changed, 11 insertions, 0 deletions
diff --git a/ssl/s3_clnt.c b/ssl/s3_clnt.c
index 7ad13579ad..f10e1aa30e 100644
--- a/ssl/s3_clnt.c
+++ b/ssl/s3_clnt.c
@@ -3280,6 +3280,12 @@ int ssl3_send_client_certificate(SSL *s)
s->state=SSL3_ST_CW_CERT_D;
l=ssl3_output_cert_chain(s,
(s->s3->tmp.cert_req == 2)?NULL:s->cert->key->x509);
+ if (!l)
+ {
+ SSLerr(SSL_F_SSL3_SEND_CLIENT_CERTIFICATE, ERR_R_INTERNAL_ERROR);
+ ssl3_send_alert(s,SSL3_AL_FATAL,SSL_AD_INTERNAL_ERROR);
+ return 0;
+ }
s->init_num=(int)l;
s->init_off=0;
}
diff --git a/ssl/s3_srvr.c b/ssl/s3_srvr.c
index c67f11a724..719e6d3e73 100644
--- a/ssl/s3_srvr.c
+++ b/ssl/s3_srvr.c
@@ -3406,6 +3406,11 @@ int ssl3_send_server_certificate(SSL *s)
}
l=ssl3_output_cert_chain(s,x);
+ if (!l)
+ {
+ SSLerr(SSL_F_SSL3_SEND_SERVER_CERTIFICATE,ERR_R_INTERNAL_ERROR);
+ return(0);
+ }
s->state=SSL3_ST_SW_CERT_B;
s->init_num=(int)l;
s->init_off=0;