diff options
author | Jay Satiro <raysatiro@yahoo.com> | 2016-02-09 03:28:58 -0500 |
---|---|---|
committer | Jay Satiro <raysatiro@yahoo.com> | 2016-02-09 03:28:58 -0500 |
commit | 4fc80f3e75c1e3ca2c3ff12ca9f9885720d5ce99 (patch) | |
tree | f56d79cc9a3b8658b5f04ed7c0c53dd1fd985e16 /src | |
parent | 6b64d735cd7ec453fabbc07a1913bdb8e6ec0a65 (diff) |
tool_doswin: Support for literal path prefix \\?\
For example something like --output \\?\C:\foo
Diffstat (limited to 'src')
-rw-r--r-- | src/tool_doswin.c | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/src/tool_doswin.c b/src/tool_doswin.c index 8650427ca..aed657a6a 100644 --- a/src/tool_doswin.c +++ b/src/tool_doswin.c @@ -150,9 +150,8 @@ SANITIZEcode sanitize_file_name(char **const sanitized, const char *file_name, if((flags & SANITIZE_ALLOW_PATH)) { #ifndef MSDOS - if((flags & SANITIZE_ALLOW_PATH) && - file_name[0] == '\\' && file_name[1] == '\\') - /* UNC prefixed path, eg \\?\C:\foo */ + if(file_name[0] == '\\' && file_name[1] == '\\') + /* UNC prefixed path \\ (eg \\?\C:\foo) */ max_sanitized_len = 32767-1; else #endif @@ -180,8 +179,16 @@ SANITIZEcode sanitize_file_name(char **const sanitized, const char *file_name, strncpy(target, file_name, len); target[len] = '\0'; +#ifndef MSDOS + if((flags & SANITIZE_ALLOW_PATH) && !strncmp(target, "\\\\?\\", 4)) + /* Skip the literal path prefix \\?\ */ + p = target + 4; + else +#endif + p = target; + /* replace control characters and other banned characters */ - for(p = target; *p; ++p) { + for(; *p; ++p) { const char *banned; if((1 <= *p && *p <= 31) || |