Expand final path name buffer for namespace prefix
As final path name includes the namespace prefix, so expand room for it in path name buffer.
This commit is contained in:
parent
4e32a4ab81
commit
67d2619463
Notes:
git
2021-02-22 19:48:37 +09:00
@ -1989,12 +1989,16 @@ open_special(const WCHAR *path, DWORD access, DWORD flags)
|
|||||||
#define BitOfIsRep(n) ((n) * 2 + 1)
|
#define BitOfIsRep(n) ((n) * 2 + 1)
|
||||||
#define DIRENT_PER_CHAR (CHAR_BIT / 2)
|
#define DIRENT_PER_CHAR (CHAR_BIT / 2)
|
||||||
|
|
||||||
|
static const WCHAR namespace_prefix[] = {L'\\', L'\\', L'?', L'\\'};
|
||||||
|
|
||||||
|
enum {FINAL_PATH_MAX = PATH_MAX + numberof(namespace_prefix)};
|
||||||
|
|
||||||
/* License: Artistic or GPL */
|
/* License: Artistic or GPL */
|
||||||
static HANDLE
|
static HANDLE
|
||||||
open_dir_handle(const WCHAR *filename, WIN32_FIND_DATAW *fd)
|
open_dir_handle(const WCHAR *filename, WIN32_FIND_DATAW *fd)
|
||||||
{
|
{
|
||||||
HANDLE fh;
|
HANDLE fh;
|
||||||
WCHAR fullname[PATH_MAX + rb_strlen_lit("\\*")];
|
WCHAR fullname[FINAL_PATH_MAX + rb_strlen_lit("\\*")];
|
||||||
WCHAR *p;
|
WCHAR *p;
|
||||||
int len = 0;
|
int len = 0;
|
||||||
|
|
||||||
@ -2004,8 +2008,12 @@ open_dir_handle(const WCHAR *filename, WIN32_FIND_DATAW *fd)
|
|||||||
|
|
||||||
fh = open_special(filename, 0, 0);
|
fh = open_special(filename, 0, 0);
|
||||||
if (fh != INVALID_HANDLE_VALUE) {
|
if (fh != INVALID_HANDLE_VALUE) {
|
||||||
len = get_final_path(fh, fullname, PATH_MAX, 0);
|
len = get_final_path(fh, fullname, FINAL_PATH_MAX, 0);
|
||||||
CloseHandle(fh);
|
CloseHandle(fh);
|
||||||
|
if (len >= FINAL_PATH_MAX) {
|
||||||
|
errno = ENAMETOOLONG;
|
||||||
|
return INVALID_HANDLE_VALUE;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (!len) {
|
if (!len) {
|
||||||
len = lstrlenW(filename);
|
len = lstrlenW(filename);
|
||||||
@ -5666,8 +5674,6 @@ path_drive(const WCHAR *path)
|
|||||||
towupper(path[0]) - L'A' : _getdrive() - 1;
|
towupper(path[0]) - L'A' : _getdrive() - 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
static const WCHAR namespace_prefix[] = {L'\\', L'\\', L'?', L'\\'};
|
|
||||||
|
|
||||||
/* License: Ruby's */
|
/* License: Ruby's */
|
||||||
static int
|
static int
|
||||||
winnt_stat(const WCHAR *path, struct stati128 *st, BOOL lstat)
|
winnt_stat(const WCHAR *path, struct stati128 *st, BOOL lstat)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user