aboutsummaryrefslogtreecommitdiff
path: root/lib/file.c
diff options
context:
space:
mode:
authorng0 <ng0@n0.is>2020-01-10 21:41:55 +0000
committerng0 <ng0@n0.is>2020-01-10 21:41:55 +0000
commit69758416170305e04324a85bfe74cd62673e298b (patch)
tree919c48ebc22eb1f92de19db98c0ac34537c51de0 /lib/file.c
parent71b588320daebd4e50603602c311bbed97755e27 (diff)
parent2cfac302fbeec68f1727cba3d1705e16f02220ad (diff)
downloadgnurl-69758416170305e04324a85bfe74cd62673e298b.tar.gz
gnurl-69758416170305e04324a85bfe74cd62673e298b.tar.bz2
gnurl-69758416170305e04324a85bfe74cd62673e298b.zip
Merge tag 'curl-7_68_0'
7.68.0
Diffstat (limited to 'lib/file.c')
-rw-r--r--lib/file.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/lib/file.c b/lib/file.c
index 45b16de48..43e1ad001 100644
--- a/lib/file.c
+++ b/lib/file.c
@@ -5,7 +5,7 @@
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
- * Copyright (C) 1998 - 2019, Daniel Stenberg, <daniel@haxx.se>, et al.
+ * Copyright (C) 1998 - 2020, Daniel Stenberg, <daniel@haxx.se>, et al.
*
* This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms
@@ -136,7 +136,7 @@ static CURLcode file_connect(struct connectdata *conn, bool *done)
struct Curl_easy *data = conn->data;
char *real_path;
struct FILEPROTO *file = data->req.protop;
- int fd;
+ int fd = -1;
#ifdef DOS_FILESYSTEM
size_t i;
char *actual_path;
@@ -181,7 +181,9 @@ static CURLcode file_connect(struct connectdata *conn, bool *done)
return CURLE_URL_MALFORMAT;
}
- fd = open_readonly(actual_path, O_RDONLY|O_BINARY);
+ if(strncmp("\\\\", actual_path, 2))
+ /* refuse to open path that starts with two backslashes */
+ fd = open_readonly(actual_path, O_RDONLY|O_BINARY);
file->path = actual_path;
#else
if(memchr(real_path, 0, real_path_len)) {