mirror of
https://github.com/curl/curl.git
synced 2026-05-07 14:07:28 +03:00
wolfssl: proof use of wolfSSL_i2d_SSL_SESSION
While wolfSSL_i2d_SSL_SESSION() does not change the passed pointer, like OpenSSL does, it may one day decide to do so. Pass a copy instead to be future-proof to such a change in wolfSSL's implementation. Closes #20008
This commit is contained in:
parent
de8470c6e5
commit
be3c226bb0
1 changed files with 5 additions and 3 deletions
|
|
@ -425,7 +425,7 @@ CURLcode Curl_wssl_cache_session(struct Curl_cfilter *cf,
|
|||
{
|
||||
CURLcode result = CURLE_OK;
|
||||
struct Curl_ssl_session *sc_session = NULL;
|
||||
unsigned char *sdata = NULL, *qtp_clone = NULL;
|
||||
unsigned char *sdata = NULL, *sdata_ptr, *qtp_clone = NULL;
|
||||
unsigned int sdata_len;
|
||||
unsigned int earlydata_max = 0;
|
||||
|
||||
|
|
@ -438,13 +438,15 @@ CURLcode Curl_wssl_cache_session(struct Curl_cfilter *cf,
|
|||
result = CURLE_FAILED_INIT;
|
||||
goto out;
|
||||
}
|
||||
sdata = curlx_calloc(1, sdata_len);
|
||||
sdata = sdata_ptr = curlx_calloc(1, sdata_len);
|
||||
if(!sdata) {
|
||||
failf(data, "unable to allocate session buffer of %u bytes", sdata_len);
|
||||
result = CURLE_OUT_OF_MEMORY;
|
||||
goto out;
|
||||
}
|
||||
sdata_len = wolfSSL_i2d_SSL_SESSION(session, &sdata);
|
||||
/* wolfSSL right now does not change the last parameter here, but it
|
||||
* might one day decide to do so for OpenSSL compatibility. */
|
||||
sdata_len = wolfSSL_i2d_SSL_SESSION(session, &sdata_ptr);
|
||||
if(sdata_len <= 0) {
|
||||
CURL_TRC_CF(data, cf, "fail to serialize session: %u", sdata_len);
|
||||
result = CURLE_FAILED_INIT;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue