mirror of
https://github.com/openssl/openssl.git
synced 2024-11-21 01:15:20 +08:00
Fix memleaks in cmd_RecordPadding()
Free the internal copy of parameter `value` on each early exit. Fixes #25906 Signed-off-by: Holger Dengler <dengler@linux.ibm.com> Reviewed-by: Matt Caswell <matt@openssl.org> Reviewed-by: Tomas Mraz <tomas@openssl.org> (Merged from https://github.com/openssl/openssl/pull/25926)
This commit is contained in:
parent
1f7d2a2887
commit
0abbd3e5ac
@ -666,22 +666,19 @@ static int cmd_RecordPadding(SSL_CONF_CTX *cctx, const char *value)
|
|||||||
|
|
||||||
copy = OPENSSL_strdup(value);
|
copy = OPENSSL_strdup(value);
|
||||||
if (copy == NULL)
|
if (copy == NULL)
|
||||||
return 0;
|
goto out;
|
||||||
commap = strstr(copy, ",");
|
commap = strstr(copy, ",");
|
||||||
if (commap != NULL) {
|
if (commap != NULL) {
|
||||||
*commap = '\0';
|
*commap = '\0';
|
||||||
if (*(commap + 1) == '\0') {
|
if (*(commap + 1) == '\0')
|
||||||
OPENSSL_free(copy);
|
goto out;
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
if (!OPENSSL_strtoul(commap + 1, &endptr, 0, &hs_padding))
|
if (!OPENSSL_strtoul(commap + 1, &endptr, 0, &hs_padding))
|
||||||
return 0;
|
goto out;
|
||||||
}
|
}
|
||||||
if (!OPENSSL_strtoul(copy, &endptr, 0, &block_padding))
|
if (!OPENSSL_strtoul(copy, &endptr, 0, &block_padding))
|
||||||
return 0;
|
goto out;
|
||||||
if (commap == NULL)
|
if (commap == NULL)
|
||||||
hs_padding = block_padding;
|
hs_padding = block_padding;
|
||||||
OPENSSL_free(copy);
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* All we care about are non-negative values,
|
* All we care about are non-negative values,
|
||||||
@ -693,6 +690,8 @@ static int cmd_RecordPadding(SSL_CONF_CTX *cctx, const char *value)
|
|||||||
if (cctx->ssl)
|
if (cctx->ssl)
|
||||||
rv = SSL_set_block_padding_ex(cctx->ssl, (size_t)block_padding,
|
rv = SSL_set_block_padding_ex(cctx->ssl, (size_t)block_padding,
|
||||||
(size_t)hs_padding);
|
(size_t)hs_padding);
|
||||||
|
out:
|
||||||
|
OPENSSL_free(copy);
|
||||||
return rv;
|
return rv;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user