← Commit list

c60d90cd65

Daniel Stenberg
Daniel Stenberg
2026-04-15
SUCCESS Duration: 272s

Subject

urlapi: make parse_file() return zero data on error

Binary

No binary (build failed)

Architecture & Compiler Flags

Architecture: x86_64-linux-gnu Compiler: gcc (Ubuntu 11.4.0-1ubuntu1~22.04.3) 11.4.0

—

Build Log

(log yok)

Commit Diff GitHub →

lib/urlapi.c+7 -4
@@ -844,6 +844,9 @@ UNITTEST CURLUcode parse_file(const char *url, size_t urllen, CURLU *u,
{
const char *path;
size_t pathlen;
+
+ *pathp = NULL;
+ *pathlenp = 0;
if(urllen <= 6)
/* file:/ is not enough to actually be a complete file: URL */
return CURLUE_BAD_FILE_URL;
@@ -852,10 +855,6 @@ UNITTEST CURLUcode parse_file(const char *url, size_t urllen, CURLU *u,
path = &url[5];
pathlen = urllen - 5;
- u->scheme = curlx_strdup("file");
- if(!u->scheme)
- return CURLUE_OUT_OF_MEMORY;
-
/* Extra handling URLs with an authority component (i.e. that start with
* "file://")
*
@@ -915,6 +914,10 @@ UNITTEST CURLUcode parse_file(const char *url, size_t urllen, CURLU *u,
pathlen--;
}
#endif
+ u->scheme = curlx_strdup("file");
+ if(!u->scheme)
+ return CURLUE_OUT_OF_MEMORY;
+
*pathp = path;
*pathlenp = pathlen;
return CURLUE_OK;