eric pouech (@epo) commented about programs/cmd/builtins.c:
if (!argN) break;
- WINE_TRACE("type: Processing arg '%s'\n", wine_dbgstr_w(thisArg)); - hIn = CreateFileW(thisArg, GENERIC_READ, FILE_SHARE_READ|FILE_SHARE_WRITE|FILE_SHARE_DELETE, NULL, OPEN_EXISTING, - FILE_ATTRIBUTE_NORMAL, NULL); - if (hIn == INVALID_HANDLE_VALUE) { + havewildcards = wcspbrk(thisArg, L"*?") ? TRUE : FALSE; + + fileNamePart = PathFindFileNameW(thisArg); + + hff = FindFirstFileW(thisArg, &fd); + + if (hff != INVALID_HANDLE_VALUE) { + do { + lstrcpyW(fileNamePart, fd.cFileName);
you'd rather want a local buffer to generate path, and check for buffer overflow -- https://gitlab.winehq.org/wine/wine/-/merge_requests/11094#note_142495