Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
Alchemy Viewer
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Deploy
Releases
Package registry
Operate
Terraform modules
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Silent mode is enabled
All outbound communications are blocked.
Learn more
.
Show more breadcrumbs
Alchemy Viewer
Alchemy Viewer
Commits
bb4a649b
Commit
bb4a649b
authored
6 years ago
by
Nat Goodspeed
Browse files
Options
Downloads
Patches
Plain Diff
SL-10153: Validate APPDATA, LOCALAPPDATA by checking existence.
parent
d72dd8a3
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
indra/llvfs/lldir_win32.cpp
+8
-13
8 additions, 13 deletions
indra/llvfs/lldir_win32.cpp
with
8 additions
and
13 deletions
indra/llvfs/lldir_win32.cpp
+
8
−
13
View file @
bb4a649b
...
@@ -104,17 +104,13 @@ LLDir_Win32::LLDir_Win32()
...
@@ -104,17 +104,13 @@ LLDir_Win32::LLDir_Win32()
mOSUserDir
=
ll_convert_wide_to_string
(
APPDATA
,
CP_UTF8
);
mOSUserDir
=
ll_convert_wide_to_string
(
APPDATA
,
CP_UTF8
);
}
}
PRELOG
(
"APPDATA='"
<<
mOSUserDir
<<
"'"
);
PRELOG
(
"APPDATA='"
<<
mOSUserDir
<<
"'"
);
// On Windows, it's a Bad Thing if a pathname contains ASCII question
// On Windows, we could have received a plain-ASCII pathname in which
// marks. In our experience, it means that the original pathname contained
// non-ASCII characters have been munged to '?', or the pathname could
// non-ASCII characters that were munged to '?' somewhere along the way.
// have been badly encoded and decoded such that we now have garbage
// Convert to LLWString first, though, in case one of the bytes in a
// instead of a valid path. Check that mOSUserDir actually exists.
// non-ASCII UTF-8 string accidentally resembles '?'.
if
(
mOSUserDir
.
empty
()
||
!
fileExists
(
mOSUserDir
))
// Bear in mind that llwchar is not necessarily wchar_t, therefore L'?' is
// not necessarily the right type.
if
(
mOSUserDir
.
empty
()
||
utf8string_to_wstring
(
mOSUserDir
).
find
(
llwchar
(
'?'
))
!=
LLWString
::
npos
)
{
{
PRELOG
(
"APPDATA
empty or contains ASCII '?'
"
);
PRELOG
(
"APPDATA
does not exist
"
);
//HRESULT okay = SHGetFolderPath(NULL, CSIDL_APPDATA, NULL, 0, w_str);
//HRESULT okay = SHGetFolderPath(NULL, CSIDL_APPDATA, NULL, 0, w_str);
wchar_t
*
pwstr
=
NULL
;
wchar_t
*
pwstr
=
NULL
;
HRESULT
okay
=
SHGetKnownFolderPath
(
FOLDERID_RoamingAppData
,
0
,
NULL
,
&
pwstr
);
HRESULT
okay
=
SHGetKnownFolderPath
(
FOLDERID_RoamingAppData
,
0
,
NULL
,
&
pwstr
);
...
@@ -149,10 +145,9 @@ LLDir_Win32::LLDir_Win32()
...
@@ -149,10 +145,9 @@ LLDir_Win32::LLDir_Win32()
PRELOG
(
"LOCALAPPDATA='"
<<
mOSCacheDir
<<
"'"
);
PRELOG
(
"LOCALAPPDATA='"
<<
mOSCacheDir
<<
"'"
);
// Windows really does not deal well with pathnames containing non-ASCII
// Windows really does not deal well with pathnames containing non-ASCII
// characters. See above remarks about APPDATA.
// characters. See above remarks about APPDATA.
if
(
mOSCacheDir
.
empty
()
||
if
(
mOSCacheDir
.
empty
()
||
!
fileExists
(
mOSCacheDir
))
utf8string_to_wstring
(
mOSCacheDir
).
find
(
llwchar
(
'?'
))
!=
LLWString
::
npos
)
{
{
PRELOG
(
"LOCALAPPDATA
empty or contains ASCII '?'
"
);
PRELOG
(
"LOCALAPPDATA
does not exist
"
);
//HRESULT okay = SHGetFolderPath(NULL, CSIDL_LOCAL_APPDATA, NULL, 0, w_str);
//HRESULT okay = SHGetFolderPath(NULL, CSIDL_LOCAL_APPDATA, NULL, 0, w_str);
wchar_t
*
pwstr
=
NULL
;
wchar_t
*
pwstr
=
NULL
;
HRESULT
okay
=
SHGetKnownFolderPath
(
FOLDERID_LocalAppData
,
0
,
NULL
,
&
pwstr
);
HRESULT
okay
=
SHGetKnownFolderPath
(
FOLDERID_LocalAppData
,
0
,
NULL
,
&
pwstr
);
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment