https://bugs.winehq.org/show_bug.cgi?id=57027
Bug ID: 57027 Summary: GetFinalPathNameByHandleW does not handle paths exceeding MAX_PATH (260 chars) Product: Wine Version: 9.0 Hardware: aarch64 OS: MacOS Status: UNCONFIRMED Severity: normal Priority: P2 Component: kernel32 Assignee: wine-bugs@winehq.org Reporter: wine@purisa.me
Hello,
I am writing a Rust program that calls canonicalize() on a path that is over 260 characters long. The Windows implementation of this function calls GetFinalPathNameByHandleW.
On Windows, this works just fine and returns a valid path. With Wine on macOS, the call returns a win32 error code ERROR_MORE_DATA (234, 0xEA). I re-ran the binary with WINEDEBUG=+relay and there is an NtStatus code STATUS_BUFFER_OVERFLOW (0x80000005) coming from NtQueryObject.
I believe this is because the buffer allocated in Wine's implementation of GetFinalPathNameByHandleW is not large enough for the ObjectInformation NtQueryObject is trying to return. Should GetFinalPathNameByHandleW fall back to a dynamically allocated buffer in this situation?
Thank you!