]> git.ipfire.org Git - thirdparty/curl.git/commitdiff
tool_getparam: do not try to expand without an argument
authorDaniel Stenberg <daniel@haxx.se>
Thu, 21 Dec 2023 08:50:00 +0000 (09:50 +0100)
committerDaniel Stenberg <daniel@haxx.se>
Thu, 21 Dec 2023 14:27:05 +0000 (15:27 +0100)
This would lead to a segfault.

Fixes #12565
Reported-by: Geeknik Labs
Closes #12575

src/tool_getparam.c

index 6b256f8224e1195d5191429c720919550f8e7a4c..79110eb7d2a4305d6708b7b039339337508846ea 100644 (file)
@@ -822,7 +822,7 @@ ParameterError getparameter(const char *flag, /* f or -long-flag */
       err = PARAM_NO_NOT_BOOLEAN;
       goto error;
     }
-    else if(expand) {
+    else if(expand && nextarg) {
       struct curlx_dynbuf nbuf;
       bool replaced;