Module: wine Branch: master Commit: 4ff3d9954eb55369ea4439ee4c56fb8ff93549b1 URL: http://source.winehq.org/git/wine.git/?a=commit;h=4ff3d9954eb55369ea4439ee4c...
Author: Kai Blin kai.blin@gmail.com Date: Tue Oct 14 12:56:16 2008 +0200
comdlg32: Avoid possible NULL pointer dereference (Coverity).
---
dlls/comdlg32/filedlg31.c | 6 ++++-- 1 files changed, 4 insertions(+), 2 deletions(-)
diff --git a/dlls/comdlg32/filedlg31.c b/dlls/comdlg32/filedlg31.c index c8fcf7e..30409af 100644 --- a/dlls/comdlg32/filedlg31.c +++ b/dlls/comdlg32/filedlg31.c @@ -312,8 +312,10 @@ static void FD31_UpdateResult(const FD31_DATA *lfs, const WCHAR *tmpstr) if (lenstr2 > 3) tmpstr2[lenstr2++]='\'; lstrcpynW(tmpstr2+lenstr2, tmpstr, BUFFILE-lenstr2); - if (ofnW->lpstrFile) - lstrcpynW(ofnW->lpstrFile, tmpstr2, ofnW->nMaxFile); + if (!ofnW->lpstrFile) + return; + + lstrcpynW(ofnW->lpstrFile, tmpstr2, ofnW->nMaxFile);
/* set filename offset */ p = PathFindFileNameW(ofnW->lpstrFile);