Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-winehq
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wine
wine-winehq
Commits
4c47385e
Commit
4c47385e
authored
Sep 21, 2012
by
Huw Davies
Committed by
Alexandre Julliard
Sep 21, 2012
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
comdlg32: Add structure size checks.
parent
9db8e593
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
30 additions
and
0 deletions
+30
-0
filedlg.c
dlls/comdlg32/filedlg.c
+30
-0
No files found.
dlls/comdlg32/filedlg.c
View file @
4c47385e
...
...
@@ -4024,6 +4024,12 @@ static void MemFree(void *mem)
HeapFree
(
GetProcessHeap
(),
0
,
mem
);
}
static
inline
BOOL
valid_struct_size
(
DWORD
size
)
{
return
(
size
==
OPENFILENAME_SIZE_VERSION_400W
)
||
(
size
==
sizeof
(
OPENFILENAMEW
));
}
static
inline
BOOL
is_win16_looks
(
DWORD
flags
)
{
return
(
flags
&
(
OFN_ALLOWMULTISELECT
|
OFN_ENABLEHOOK
|
OFN_ENABLETEMPLATE
)
&&
...
...
@@ -4047,6 +4053,12 @@ BOOL WINAPI GetOpenFileNameA(
{
TRACE
(
"flags %08x
\n
"
,
ofn
->
Flags
);
if
(
!
valid_struct_size
(
ofn
->
lStructSize
))
{
COMDLG32_SetCommDlgExtendedError
(
CDERR_STRUCTSIZE
);
return
FALSE
;
}
/* OFN_FILEMUSTEXIST implies OFN_PATHMUSTEXIST */
if
(
ofn
->
Flags
&
OFN_FILEMUSTEXIST
)
ofn
->
Flags
|=
OFN_PATHMUSTEXIST
;
...
...
@@ -4072,6 +4084,12 @@ BOOL WINAPI GetOpenFileNameW(
{
TRACE
(
"flags %08x
\n
"
,
ofn
->
Flags
);
if
(
!
valid_struct_size
(
ofn
->
lStructSize
))
{
COMDLG32_SetCommDlgExtendedError
(
CDERR_STRUCTSIZE
);
return
FALSE
;
}
/* OFN_FILEMUSTEXIST implies OFN_PATHMUSTEXIST */
if
(
ofn
->
Flags
&
OFN_FILEMUSTEXIST
)
ofn
->
Flags
|=
OFN_PATHMUSTEXIST
;
...
...
@@ -4096,6 +4114,12 @@ BOOL WINAPI GetOpenFileNameW(
BOOL
WINAPI
GetSaveFileNameA
(
LPOPENFILENAMEA
ofn
)
/* [in/out] address of init structure */
{
if
(
!
valid_struct_size
(
ofn
->
lStructSize
))
{
COMDLG32_SetCommDlgExtendedError
(
CDERR_STRUCTSIZE
);
return
FALSE
;
}
if
(
is_win16_looks
(
ofn
->
Flags
))
return
GetFileName31A
(
ofn
,
SAVE_DIALOG
);
else
...
...
@@ -4115,6 +4139,12 @@ BOOL WINAPI GetSaveFileNameA(
BOOL
WINAPI
GetSaveFileNameW
(
LPOPENFILENAMEW
ofn
)
/* [in/out] address of init structure */
{
if
(
!
valid_struct_size
(
ofn
->
lStructSize
))
{
COMDLG32_SetCommDlgExtendedError
(
CDERR_STRUCTSIZE
);
return
FALSE
;
}
if
(
is_win16_looks
(
ofn
->
Flags
))
return
GetFileName31W
(
ofn
,
SAVE_DIALOG
);
else
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment