Commit f05549b7 authored by Piotr Caban's avatar Piotr Caban Committed by Alexandre Julliard

msvcrt: Add support for quoted paths in _wsearchenv_s.

parent 98c554ac
...@@ -1833,12 +1833,27 @@ int CDECL MSVCRT__wsearchenv_s(const MSVCRT_wchar_t* file, const MSVCRT_wchar_t* ...@@ -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)) for(; *penv; penv = (*end ? end + 1 : end))
{ {
end = penv; end = penv;
while(*end && *end != ';') end++; /* Find end of next path */ path_len = 0;
path_len = end - penv; 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) if (!path_len || path_len >= MAX_PATH)
continue; continue;
memcpy(path, penv, path_len * sizeof(MSVCRT_wchar_t));
if (path[path_len - 1] != '/' && path[path_len - 1] != '\\') if (path[path_len - 1] != '/' && path[path_len - 1] != '\\')
path[path_len++] = '\\'; path[path_len++] = '\\';
if (path_len + fname_len >= MAX_PATH) if (path_len + fname_len >= MAX_PATH)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment