Skip to content

Commit

Permalink
Fix a possible memory leak in sxnet_v2i
Browse files Browse the repository at this point in the history
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 #23234)

(cherry picked from commit 0151e77)
  • Loading branch information
bernd-edlinger authored and t8m committed Jan 10, 2024
1 parent 99cbe4e commit 267ffc0
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion crypto/x509/v3_sxnet.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down

0 comments on commit 267ffc0

Please sign in to comment.