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.
https://bugs.winehq.org/show_bug.cgi?id=37848
Mikhail Bystryantsev ho-rr-or@mail.ru changed:
What |Removed |Added ---------------------------------------------------------------------------- CC| |ho-rr-or@mail.ru
https://bugs.winehq.org/show_bug.cgi?id=37848
--- Comment #1 from Mikhail Bystryantsev ho-rr-or@mail.ru --- Created attachment 50411 --> https://bugs.winehq.org/attachment.cgi?id=50411 Possible solution patch
There is possible solution (alternative is using heap allocation)
https://bugs.winehq.org/show_bug.cgi?id=37848
Bruno Jesus 00cpxxx@gmail.com changed:
What |Removed |Added ---------------------------------------------------------------------------- Status|UNCONFIRMED |NEW Ever confirmed|0 |1
--- Comment #2 from Bruno Jesus 00cpxxx@gmail.com --- Confirming, I just sent a patch: http://source.winehq.org/patches/data/108483
https://bugs.winehq.org/show_bug.cgi?id=37848
Bruno Jesus 00cpxxx@gmail.com changed:
What |Removed |Added ---------------------------------------------------------------------------- Fixed by SHA1| |5a469f1b87e58fd96dfb68f1e89 | |2c0d3cae5a97b Status|NEW |RESOLVED Resolution|--- |FIXED
--- Comment #3 from Bruno Jesus 00cpxxx@gmail.com --- Fixed by http://source.winehq.org/git/wine.git/?a=commit;h=5a469f1b87e58fd96dfb68f1e8...
Thanks for the report.
https://bugs.winehq.org/show_bug.cgi?id=37848
Alexandre Julliard julliard@winehq.org changed:
What |Removed |Added ---------------------------------------------------------------------------- Status|RESOLVED |CLOSED
--- Comment #4 from Alexandre Julliard julliard@winehq.org --- Closing bugs fixed in 1.7.34.