summaryrefslogtreecommitdiff
path: root/src/win32
diff options
context:
space:
mode:
authorEdward Thomson <ethomson@edwardthomson.com>2021-08-25 12:20:50 -0400
committerGitHub <noreply@github.com>2021-08-25 12:20:50 -0400
commit0850b1722cbd5095aa6f6e307b9c1bac49228d53 (patch)
tree3f5634b935981136f651c7bcc3f0dd48dbf0a61c /src/win32
parentcc4f8bc65e7dfc6673b83645b2f323bf555088e8 (diff)
parent4584660e11ee5fd6e9fb44b0d00bf7cb8df8edb4 (diff)
downloadlibgit2-0850b1722cbd5095aa6f6e307b9c1bac49228d53.tar.gz
Merge pull request #5950 from boretrk/posixtest
open: input validation for empty segments in path
Diffstat (limited to 'src/win32')
-rw-r--r--src/win32/posix_w32.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/win32/posix_w32.c b/src/win32/posix_w32.c
index 0a8f2bee0..7fcc472e9 100644
--- a/src/win32/posix_w32.c
+++ b/src/win32/posix_w32.c
@@ -543,6 +543,13 @@ int p_open(const char *path, int flags, ...)
mode_t mode = 0;
struct open_opts opts = {0};
+ #ifdef GIT_DEBUG_STRICT_OPEN
+ if (strstr(path, "//") != NULL) {
+ errno = EACCES;
+ return -1;
+ }
+ #endif
+
if (git_win32_path_from_utf8(wpath, path) < 0)
return -1;