Fix crash if lpuCurDirLen or lpuDestDirLen==0.

This commit is contained in:
Douglas Ridgway 1999-03-17 15:10:40 +00:00 committed by Alexandre Julliard
parent f3f08f168f
commit 4d9981846c

View file

@ -274,9 +274,11 @@ DWORD WINAPI VerFindFileA(
if(lpuDestDirLen && lpszDestDir) {
if(*lpuDestDirLen < destDirSizeReq) {
retval |= VFF_BUFFTOOSMALL;
if (*lpuDestDirLen) {
strncpy(lpszDestDir, destDir, *lpuDestDirLen - 1);
lpszDestDir[*lpuDestDirLen - 1] = '\0';
}
}
else
strcpy(lpszDestDir, destDir);
@ -286,8 +288,10 @@ DWORD WINAPI VerFindFileA(
if(lpuCurDirLen && lpszCurDir) {
if(*lpuCurDirLen < curDirSizeReq) {
retval |= VFF_BUFFTOOSMALL;
if (*lpuCurDirLen) {
strncpy(lpszCurDir, curDir, *lpuCurDirLen - 1);
lpszCurDir[*lpuCurDirLen - 1] = '\0';
}
}
else
strcpy(lpszCurDir, curDir);