From: x2018 Date: Tue, 4 Nov 2025 08:49:28 +0000 (+0800) Subject: tool_ipfs: check the return value of curl_url_get for gwpath X-Git-Tag: curl-8_17_0~9 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=11683f121d42f8a18b3385d41f89d2285f90f4e6;p=thirdparty%2Fcurl.git tool_ipfs: check the return value of curl_url_get for gwpath Closes #19358 --- diff --git a/src/tool_ipfs.c b/src/tool_ipfs.c index 1f77dad47f..8e98d23242 100644 --- a/src/tool_ipfs.c +++ b/src/tool_ipfs.c @@ -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,