diff --git a/winsup/cygwin/ChangeLog b/winsup/cygwin/ChangeLog index 9a48b097d..94615cffb 100644 --- a/winsup/cygwin/ChangeLog +++ b/winsup/cygwin/ChangeLog @@ -1,3 +1,9 @@ +2012-02-15 Corinna Vinschen + + * dtable.cc (dtable::init_std_file_from_handle): Use tmp_pathbuf for + name. + (handle_to_fn): Ditto for device. Fix size in QueryDosDeviceW call. + 2012-02-15 Christopher Faylor * smallprint.cc (tmpbuf): Declare new class holding a static buffer, diff --git a/winsup/cygwin/dtable.cc b/winsup/cygwin/dtable.cc index e06936c6a..612506e0c 100644 --- a/winsup/cygwin/dtable.cc +++ b/winsup/cygwin/dtable.cc @@ -262,6 +262,7 @@ cygwin_attach_handle_to_fd (char *name, int fd, HANDLE handle, mode_t bin, void dtable::init_std_file_from_handle (int fd, HANDLE handle) { + tmp_pathbuf tp; CONSOLE_SCREEN_BUFFER_INFO buf; DCB dcb; unsigned bin = O_BINARY; @@ -275,7 +276,7 @@ dtable::init_std_file_from_handle (int fd, HANDLE handle) SetLastError (0); DWORD access = 0; DWORD ft = GetFileType (handle); - char name[NT_MAX_PATH]; + char *name = tp.c_get (); name[0] = '\0'; if (ft == FILE_TYPE_UNKNOWN && GetLastError () == ERROR_INVALID_HANDLE) /* can't figure out what this is */; @@ -889,6 +890,7 @@ handle_to_fn (HANDLE h, char *posix_fn) tmp_pathbuf tp; ULONG len = 0; WCHAR *maxmatchdos = NULL; + PWCHAR device = tp.w_get (); int maxmatchlen = 0; OBJECT_NAME_INFORMATION *ntfn = (OBJECT_NAME_INFORMATION *) tp.w_get (); @@ -949,8 +951,7 @@ handle_to_fn (HANDLE h, char *posix_fn) for (WCHAR *s = fnbuf; *s; s = wcschr (s, '\0') + 1) { - WCHAR device[NT_MAX_PATH]; - if (!QueryDosDeviceW (s, device, sizeof (device))) + if (!QueryDosDeviceW (s, device, NT_MAX_PATH)) continue; if (wcschr (s, ':') == NULL) continue;