Commit bdbc45fd authored by Huw Davies's avatar Huw Davies Committed by Alexandre Julliard

comdlg32: Only copy the valid portion of the structure.

parent 915df87a
...@@ -556,8 +556,9 @@ static LRESULT FD31_Validate( const FD31_DATA *lfs, LPCWSTR path, UINT control, ...@@ -556,8 +556,9 @@ static LRESULT FD31_Validate( const FD31_DATA *lfs, LPCWSTR path, UINT control,
OPENFILENAMEW ofnsav; OPENFILENAMEW ofnsav;
LPOPENFILENAMEW ofnW = lfs->ofnW; LPOPENFILENAMEW ofnW = lfs->ofnW;
WCHAR filename[BUFFILE]; 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 */ /* get current file name */
if (path) if (path)
...@@ -591,7 +592,7 @@ static LRESULT FD31_Validate( const FD31_DATA *lfs, LPCWSTR path, UINT control, ...@@ -591,7 +592,7 @@ static LRESULT FD31_Validate( const FD31_DATA *lfs, LPCWSTR path, UINT control,
0, lfs->lParam ); 0, lfs->lParam );
if (lRet) if (lRet)
{ {
*ofnW = ofnsav; /* restore old state */ memcpy( ofnW, &ofnsav, copied_size ); /* restore old state */
return FALSE; return FALSE;
} }
} }
......
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