mirror of
git://source.winehq.org/git/wine.git
synced 2024-09-06 03:50:21 +00:00
msvcrt: Add support for quoted paths in _wsearchenv_s.
Signed-off-by: Piotr Caban <piotr@codeweavers.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
98c554ac06
commit
f05549b7f7
|
@ -1833,12 +1833,27 @@ int CDECL MSVCRT__wsearchenv_s(const MSVCRT_wchar_t* file, const MSVCRT_wchar_t*
|
|||
for(; *penv; penv = (*end ? end + 1 : end))
|
||||
{
|
||||
end = penv;
|
||||
while(*end && *end != ';') end++; /* Find end of next path */
|
||||
path_len = end - penv;
|
||||
path_len = 0;
|
||||
while(*end && *end != ';' && path_len < MAX_PATH)
|
||||
{
|
||||
if (*end == '"')
|
||||
{
|
||||
end++;
|
||||
while(*end && *end != '"' && path_len < MAX_PATH)
|
||||
{
|
||||
path[path_len++] = *end;
|
||||
end++;
|
||||
}
|
||||
if (*end == '"') end++;
|
||||
continue;
|
||||
}
|
||||
|
||||
path[path_len++] = *end;
|
||||
end++;
|
||||
}
|
||||
if (!path_len || path_len >= MAX_PATH)
|
||||
continue;
|
||||
|
||||
memcpy(path, penv, path_len * sizeof(MSVCRT_wchar_t));
|
||||
if (path[path_len - 1] != '/' && path[path_len - 1] != '\\')
|
||||
path[path_len++] = '\\';
|
||||
if (path_len + fname_len >= MAX_PATH)
|
||||
|
|
Loading…
Reference in a new issue