wolfssl: add proper colon separator

Follow-up to 6fd5a9777a

Fixes #15132
Reported-by: Viktor Szakats
Closes #15134
This commit is contained in:
Daniel Stenberg 2024-10-03 08:26:44 +02:00
parent 98591551dc
commit 78ed473dbc
No known key found for this signature in database
GPG Key ID: 5CC908FDB71E12C2

View File

@ -642,8 +642,15 @@ wssl_add_default_ciphers(bool tls13, struct dynbuf *buf)
if((strncmp(str, "TLS13", 5) == 0) != tls13) if((strncmp(str, "TLS13", 5) == 0) != tls13)
continue; continue;
/* if there already is data in the string, add colon separator */
if(Curl_dyn_len(buf)) {
CURLcode result = Curl_dyn_addn(buf, ":", 1);
if(result)
return result;
}
n = strlen(str); n = strlen(str);
if(Curl_dyn_addn(buf, str, n) || Curl_dyn_addn(buf, ":", 1)) if(Curl_dyn_addn(buf, str, n))
return CURLE_OUT_OF_MEMORY; return CURLE_OUT_OF_MEMORY;
} }
@ -800,7 +807,7 @@ wolfssl_connect_step1(struct Curl_cfilter *cf, struct Curl_easy *data)
} }
} }
#else #else
#define MAX_CIPHER_LEN 1024 #define MAX_CIPHER_LEN 4096
if(conn_config->cipher_list || conn_config->cipher_list13) { if(conn_config->cipher_list || conn_config->cipher_list13) {
const char *ciphers12 = conn_config->cipher_list; const char *ciphers12 = conn_config->cipher_list;
const char *ciphers13 = conn_config->cipher_list13; const char *ciphers13 = conn_config->cipher_list13;
@ -814,8 +821,12 @@ wolfssl_connect_step1(struct Curl_cfilter *cf, struct Curl_easy *data)
result = wssl_add_default_ciphers(TRUE, &c); result = wssl_add_default_ciphers(TRUE, &c);
if(!result) { if(!result) {
if(ciphers12) if(ciphers12) {
result = Curl_dyn_add(&c, ciphers12); if(Curl_dyn_len(&c))
result = Curl_dyn_addn(&c, ":", 1);
if(!result)
result = Curl_dyn_add(&c, ciphers12);
}
else else
result = wssl_add_default_ciphers(FALSE, &c); result = wssl_add_default_ciphers(FALSE, &c);
} }