diff options
| author | dartraiden <wowemuh@gmail.com> | 2024-09-11 21:49:43 +0300 |
|---|---|---|
| committer | dartraiden <wowemuh@gmail.com> | 2024-09-11 21:52:35 +0300 |
| commit | c36db68a5f58ec6c9135eff778b6e77c30e58088 (patch) | |
| tree | 22eea126db82c50388c9f94cd683d6ec6f04e6cb /libs/libcurl/src/urlapi.c | |
| parent | 02bb82c1c0a4031e7b2f5578370fa5acd620f8e1 (diff) | |
libcurl: update to 8.10.0
Diffstat (limited to 'libs/libcurl/src/urlapi.c')
| -rw-r--r-- | libs/libcurl/src/urlapi.c | 24 |
1 files changed, 20 insertions, 4 deletions
diff --git a/libs/libcurl/src/urlapi.c b/libs/libcurl/src/urlapi.c index 2179e106de..9e7565c0f7 100644 --- a/libs/libcurl/src/urlapi.c +++ b/libs/libcurl/src/urlapi.c @@ -41,13 +41,13 @@ #include "curl_memory.h"
#include "memdebug.h"
- /* MSDOS/Windows style drive prefix, eg c: in c:foo */
+ /* MS-DOS/Windows style drive prefix, eg c: in c:foo */
#define STARTS_WITH_DRIVE_PREFIX(str) \
((('a' <= str[0] && str[0] <= 'z') || \
('A' <= str[0] && str[0] <= 'Z')) && \
(str[1] == ':'))
- /* MSDOS/Windows style drive prefix, optionally with
+ /* MS-DOS/Windows style drive prefix, optionally with
* a '|' instead of ':', followed by a slash or NUL */
#define STARTS_WITH_URL_DRIVE_PREFIX(str) \
((('a' <= (str)[0] && (str)[0] <= 'z') || \
@@ -1121,7 +1121,7 @@ static CURLUcode parseurl(const char *url, CURLU *u, unsigned int flags) * This catches both "file:/c:" and "file:c:" */
if(('/' == path[0] && STARTS_WITH_URL_DRIVE_PREFIX(&path[1])) ||
STARTS_WITH_URL_DRIVE_PREFIX(path)) {
- /* File drive letters are only accepted in MSDOS/Windows */
+ /* File drive letters are only accepted in MS-DOS/Windows */
result = CURLUE_BAD_FILE_URL;
goto fail;
}
@@ -1991,7 +1991,23 @@ nomem: /* Skip hostname check, it is allowed to be empty. */
}
else {
- if(!n || hostname_check(u, (char *)newp, n)) {
+ bool bad = FALSE;
+ if(!n)
+ bad = TRUE; /* empty hostname is not okay */
+ else if(!urlencode) {
+ /* if the host name part was not URL encoded here, it was set ready
+ URL encoded so we need to decode it to check */
+ size_t dlen;
+ char *decoded = NULL;
+ CURLcode result =
+ Curl_urldecode(newp, n, &decoded, &dlen, REJECT_CTRL);
+ if(result || hostname_check(u, decoded, dlen))
+ bad = TRUE;
+ free(decoded);
+ }
+ else if(hostname_check(u, (char *)newp, n))
+ bad = TRUE;
+ if(bad) {
Curl_dyn_free(&enc);
return CURLUE_BAD_HOSTNAME;
}
|
