Huw Davies : comdlg32: Only copy the valid portion of the structure.
Alexandre Julliard
julliard at winehq.org
Fri Sep 21 14:22:40 CDT 2012
Module: wine
Branch: master
Commit: bdbc45fddd583c9273511419e49ff815c516d8c1
URL: http://source.winehq.org/git/wine.git/?a=commit;h=bdbc45fddd583c9273511419e49ff815c516d8c1
Author: Huw Davies <huw at codeweavers.com>
Date: Fri Sep 21 13:22:45 2012 +0100
comdlg32: Only copy the valid portion of the structure.
---
dlls/comdlg32/filedlg31.c | 5 +++--
1 files changed, 3 insertions(+), 2 deletions(-)
diff --git a/dlls/comdlg32/filedlg31.c b/dlls/comdlg32/filedlg31.c
index 4a78958..f0763c5 100644
--- a/dlls/comdlg32/filedlg31.c
+++ b/dlls/comdlg32/filedlg31.c
@@ -556,8 +556,9 @@ static LRESULT FD31_Validate( const FD31_DATA *lfs, LPCWSTR path, UINT control,
OPENFILENAMEW ofnsav;
LPOPENFILENAMEW ofnW = lfs->ofnW;
WCHAR filename[BUFFILE];
+ int copied_size = min( ofnW->lStructSize, sizeof(ofnsav) );
- ofnsav = *ofnW; /* for later restoring */
+ memcpy( &ofnsav, ofnW, copied_size ); /* for later restoring */
/* get current file name */
if (path)
@@ -591,7 +592,7 @@ static LRESULT FD31_Validate( const FD31_DATA *lfs, LPCWSTR path, UINT control,
0, lfs->lParam );
if (lRet)
{
- *ofnW = ofnsav; /* restore old state */
+ memcpy( ofnW, &ofnsav, copied_size ); /* restore old state */
return FALSE;
}
}
More information about the wine-cvs
mailing list