]> git.ipfire.org Git - thirdparty/curl.git/commitdiff
tool_getparam: fix the ECH parser
authorDaniel Stenberg <daniel@haxx.se>
Sat, 14 Dec 2024 09:41:05 +0000 (10:41 +0100)
committerDaniel Stenberg <daniel@haxx.se>
Sat, 14 Dec 2024 10:51:30 +0000 (11:51 +0100)
The pn: and ecl: prefixes were not handled correctly.

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

Closes #15741

src/tool_getparam.c

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