https://bugs.winehq.org/show_bug.cgi?id=37848
Bug ID: 37848 Summary: For loop %~$PATH:I feature works incorrect - PATH variable size limited by MAX_PATH Product: Wine Version: 1.7.33 Hardware: x86 OS: Linux Status: UNCONFIRMED Severity: normal Priority: P2 Component: cmd Assignee: wine-bugs@winehq.org Reporter: ho-rr-or@mail.ru Distribution: ---
Created attachment 50409 --> https://bugs.winehq.org/attachment.cgi?id=50409 Batch file for reproduce
For loop has %~$PATH:I syntax for search file in path list from PATH variable, but it is not works when PATH variable size more then MAX_PATH.
Seems like there are invalid code in batch.c: WCHAR fullpath[MAX_PATH]; // ... /* If env var not found, return empty string */ if ((GetEnvironmentVariableW(env, fullpath, MAX_PATH) == 0) || (SearchPathW(fullpath, outputparam, NULL, MAX_PATH, outputparam, NULL) == 0)) { finaloutput[0] = 0x00; outputparam[0] = 0x00; skipFileParsing = TRUE; }
Actually PATH length can be greater then MAX_PATH, so it is wrong behavior. Size of fullpath should be based on variable size.