This fixes the torture failures in 1675
Also, make it allocate the scheme *after* the path has been verified, so
that it is avoided in the common error cases.
Fixes #21326
Closes #21324
{
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;
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://")
*
pathlen--;
}
#endif
+ u->scheme = curlx_strdup("file");
+ if(!u->scheme)
+ return CURLUE_OUT_OF_MEMORY;
+
*pathp = path;
*pathlenp = pathlen;
return CURLUE_OK;