diff options
author | Bernd Edlinger <bernd.edlinger@hotmail.de> | 2024-01-08 15:31:32 +0100 |
---|---|---|
committer | Tomas Mraz <tomas@openssl.org> | 2024-01-10 18:14:37 +0100 |
commit | 5339f541238aab81e3dd43f2bc6c5cde716be349 (patch) | |
tree | fd7e10b19b1833d4b2569105d7048319d6142a49 | |
parent | bee1e83a18d6820b4264cbefca9ff5576ff679c2 (diff) |
Fix a possible memory leak in sxnet_v2i
When a subsequent call to SXNET_add_id_asc fails
e.g. because user is a string larger than 64 char
or the zone is a duplicate zone id,
or the zone is not an integer,
a memory leak may be the result.
Reviewed-by: Matt Caswell <matt@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/23234)
(cherry picked from commit 0151e772195fc03cce0f12e5e266e51dc15243a0)
-rw-r--r-- | crypto/x509/v3_sxnet.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/crypto/x509/v3_sxnet.c b/crypto/x509/v3_sxnet.c index 09e16956b6..5ad1040019 100644 --- a/crypto/x509/v3_sxnet.c +++ b/crypto/x509/v3_sxnet.c @@ -103,8 +103,10 @@ static SXNET *sxnet_v2i(X509V3_EXT_METHOD *method, X509V3_CTX *ctx, int i; for (i = 0; i < sk_CONF_VALUE_num(nval); i++) { cnf = sk_CONF_VALUE_value(nval, i); - if (!SXNET_add_id_asc(&sx, cnf->name, cnf->value, -1)) + if (!SXNET_add_id_asc(&sx, cnf->name, cnf->value, -1)) { + SXNET_free(sx); return NULL; + } } return sx; } |