tool_getparam: fix the ECH parser

The pn: and ecl: prefixes were not handled correctly.

CodeSonar helped me realize as it poined out an "Unreachable Data Flow"

Closes #15741
This commit is contained in:
Daniel Stenberg 2024-12-14 10:41:05 +01:00
parent cffbbc693e
commit 6bb76d92e1
No known key found for this signature in database
GPG Key ID: 5CC908FDB71E12C2

View File

@ -1135,11 +1135,13 @@ static ParameterError parse_ech(struct GlobalConfig *global,
err = PARAM_LIBCURL_DOESNT_SUPPORT; err = PARAM_LIBCURL_DOESNT_SUPPORT;
else if(strlen(nextarg) > 4 && strncasecompare("pn:", nextarg, 3)) { else if(strlen(nextarg) > 4 && strncasecompare("pn:", nextarg, 3)) {
/* a public_name */ /* a public_name */
nextarg += 3;
err = getstr(&config->ech_public, nextarg, DENY_BLANK); err = getstr(&config->ech_public, nextarg, DENY_BLANK);
} }
else if(strlen(nextarg) > 5 && strncasecompare("ecl:", nextarg, 4)) { else if(strlen(nextarg) > 5 && strncasecompare("ecl:", nextarg, 4)) {
/* an ECHConfigList */ /* an ECHConfigList */
if('@' != *(nextarg + 4)) { nextarg += 4;
if('@' != *nextarg) {
err = getstr(&config->ech_config, nextarg, DENY_BLANK); err = getstr(&config->ech_config, nextarg, DENY_BLANK);
} }
else { else {