diff options
author | Pauli <paul.dale@oracle.com> | 2017-09-19 08:48:14 +1000 |
---|---|---|
committer | Pauli <paul.dale@oracle.com> | 2017-09-28 06:53:40 +1000 |
commit | e431363f8c241abd0dfe9b83dfc1cec1bdfe13ab (patch) | |
tree | 1f4d44a49ed133216ac06b19d8e9b3c37e0b6b3c /crypto/x509v3 | |
parent | 1b3e2bbf64b96f636277ca29b31ba152c1831e74 (diff) |
Add stack space reservations.
Reviewed-by: Andy Polyakov <appro@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/4386)
Diffstat (limited to 'crypto/x509v3')
-rw-r--r-- | crypto/x509v3/v3_info.c | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/crypto/x509v3/v3_info.c b/crypto/x509v3/v3_info.c index c2c09499f8..6b98575cb0 100644 --- a/crypto/x509v3/v3_info.c +++ b/crypto/x509v3/v3_info.c @@ -107,20 +107,23 @@ static AUTHORITY_INFO_ACCESS *v2i_AUTHORITY_INFO_ACCESS(X509V3_EXT_METHOD CONF_VALUE *cnf, ctmp; ACCESS_DESCRIPTION *acc; int i, objlen; + const int num = sk_CONF_VALUE_num(nval); char *objtmp, *ptmp; if ((ainfo = sk_ACCESS_DESCRIPTION_new_null()) == NULL) { X509V3err(X509V3_F_V2I_AUTHORITY_INFO_ACCESS, ERR_R_MALLOC_FAILURE); return NULL; } - for (i = 0; i < sk_CONF_VALUE_num(nval); i++) { + if (!sk_ACCESS_DESCRIPTION_reserve(ainfo, num)) + goto err; + for (i = 0; i < num; i++) { cnf = sk_CONF_VALUE_value(nval, i); - if ((acc = ACCESS_DESCRIPTION_new()) == NULL - || !sk_ACCESS_DESCRIPTION_push(ainfo, acc)) { + if ((acc = ACCESS_DESCRIPTION_new()) == NULL) { X509V3err(X509V3_F_V2I_AUTHORITY_INFO_ACCESS, ERR_R_MALLOC_FAILURE); goto err; } + sk_ACCESS_DESCRIPTION_push(ainfo, acc); /* Cannot fail due to reserve */ ptmp = strchr(cnf->name, ';'); if (!ptmp) { X509V3err(X509V3_F_V2I_AUTHORITY_INFO_ACCESS, |