]> git.ipfire.org Git - thirdparty/curl.git/commitdiff
tool_ipfs: check the return value of curl_url_get for gwpath
authorx2018 <xkernel.wang@foxmail.com>
Tue, 4 Nov 2025 08:49:28 +0000 (16:49 +0800)
committerDaniel Stenberg <daniel@haxx.se>
Tue, 4 Nov 2025 13:13:00 +0000 (14:13 +0100)
Closes #19358

src/tool_ipfs.c

index 1f77dad47fcc8152e27d3c3ec65e4b7be17df6e2..8e98d23242ee2a28f371f74e5ca7795b03ae3aae 100644 (file)
@@ -176,7 +176,9 @@ CURLcode ipfs_url_rewrite(CURLU *uh, const char *protocol, char **url,
   }
 
   curl_url_get(gatewayurl, CURLUPART_PORT, &gwport, CURLU_URLDECODE);
-  curl_url_get(gatewayurl, CURLUPART_PATH, &gwpath, CURLU_URLDECODE);
+
+  if(curl_url_get(gatewayurl, CURLUPART_PATH, &gwpath, CURLU_URLDECODE))
+    goto clean;
 
   /* get the path from user input */
   curl_url_get(uh, CURLUPART_PATH, &inputpath, CURLU_URLDECODE);
@@ -192,7 +194,6 @@ CURLcode ipfs_url_rewrite(CURLU *uh, const char *protocol, char **url,
   if(inputpath && (inputpath[0] == '/') && !inputpath[1])
     *inputpath = '\0';
 
-
   pathbuffer = curl_maprintf("%s%s%s/%s%s", gwpath,
                              has_trailing_slash(gwpath) ? "" : "/",
                              protocol, cid,