summaryrefslogtreecommitdiffstats
path: root/ssl/ssl_lib.c
diff options
context:
space:
mode:
authorPauli <paul.dale@oracle.com>2017-09-19 08:48:14 +1000
committerPauli <paul.dale@oracle.com>2017-09-28 06:53:40 +1000
commite431363f8c241abd0dfe9b83dfc1cec1bdfe13ab (patch)
tree1f4d44a49ed133216ac06b19d8e9b3c37e0b6b3c /ssl/ssl_lib.c
parent1b3e2bbf64b96f636277ca29b31ba152c1831e74 (diff)
Add stack space reservations.
Reviewed-by: Andy Polyakov <appro@openssl.org> (Merged from https://github.com/openssl/openssl/pull/4386)
Diffstat (limited to 'ssl/ssl_lib.c')
-rw-r--r--ssl/ssl_lib.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/ssl/ssl_lib.c b/ssl/ssl_lib.c
index e04feec2cd..85425a1887 100644
--- a/ssl/ssl_lib.c
+++ b/ssl/ssl_lib.c
@@ -161,6 +161,7 @@ static int ssl_dane_dup(SSL *to, SSL *from)
if (!DANETLS_ENABLED(&from->dane))
return 1;
+ num = sk_danetls_record_num(from->dane.trecs);
dane_final(&to->dane);
to->dane.flags = from->dane.flags;
to->dane.dctx = &to->ctx->dane;
@@ -170,8 +171,9 @@ static int ssl_dane_dup(SSL *to, SSL *from)
SSLerr(SSL_F_SSL_DANE_DUP, ERR_R_MALLOC_FAILURE);
return 0;
}
+ if (!sk_danetls_record_reserve(to->dane.trecs, num))
+ return 0;
- num = sk_danetls_record_num(from->dane.trecs);
for (i = 0; i < num; ++i) {
danetls_record *t = sk_danetls_record_value(from->dane.trecs, i);