buffer check in comdlg
Robert Shearman
rob at codeweavers.com
Thu Apr 6 17:31:31 CDT 2006
Aric Stewart wrote:
> if(fodInfos->unicode)
> {
> LPOPENFILENAMEW ofn = fodInfos->ofnInfos;
>- strcpyW( ofn->lpstrFile, lpstrPathSpec);
>- memcpy( ofn->lpstrFile + nSizePath, lpstrFileList, sizeUsed*sizeof(WCHAR) );
>+ if (nSizePath+sizeUsed > ofn->nMaxFile)
>+ {
>+ *((WORD*)ofn->lpstrFile)=nSizePath+sizeUsed;
>+ FILEDLG95_Clean(hwnd);
>+ EndDialog(hwnd,FALSE);
>+ COMDLG32_SetCommDlgExtendedError(FNERR_BUFFERTOOSMALL);
>+ return FALSE;
>+ }
>+ else
>+ {
>+ strcpyW( ofn->lpstrFile, lpstrPathSpec);
>+ memcpy( ofn->lpstrFile + nSizePath, lpstrFileList, sizeUsed*sizeof(WCHAR) );
>+ }
> }
>
>
This formatting doesn't look at all consistent, either with itself or
the other code there.
--
Rob Shearman
More information about the wine-devel
mailing list