[Bug 37848] New: For loop %~$PATH:I feature works incorrect - PATH variable size limited by MAX_PATH

wine-bugs at winehq.org wine-bugs at winehq.org
Mon Jan 5 06:12:04 CST 2015


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 at winehq.org
          Reporter: ho-rr-or at 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.

-- 
Do not reply to this email, post in Bugzilla using the
above URL to reply.
You are receiving this mail because:
You are watching all bug changes.



More information about the wine-bugs mailing list