Marcus Meissner : setupx.dll16: Avoid strcmp() result truncation (Coverity) .
Alexandre Julliard
julliard at winehq.org
Mon Jul 9 14:56:37 CDT 2012
Module: wine
Branch: master
Commit: a181e4dfe9e7a4c9644194fc8a5748d52ba2a53f
URL: http://source.winehq.org/git/wine.git/?a=commit;h=a181e4dfe9e7a4c9644194fc8a5748d52ba2a53f
Author: Marcus Meissner <marcus at jet.franken.de>
Date: Sat Jul 7 11:52:22 2012 +0200
setupx.dll16: Avoid strcmp() result truncation (Coverity).
---
dlls/setupx.dll16/virtcopy.c | 10 +++++++++-
1 files changed, 9 insertions(+), 1 deletions(-)
diff --git a/dlls/setupx.dll16/virtcopy.c b/dlls/setupx.dll16/virtcopy.c
index a718ac9..141fbd2 100644
--- a/dlls/setupx.dll16/virtcopy.c
+++ b/dlls/setupx.dll16/virtcopy.c
@@ -591,9 +591,17 @@ static void VCP_UI_RegisterProgressClass(void)
static RETERR16 VCP_UI_NodeCompare(LPVIRTNODE vn1, LPVIRTNODE vn2)
{
LPCSTR file1, file2;
+ int ret;
file1 = vsmGetStringRawName16(vn1->vfsSrc.vhstrFileName);
file2 = vsmGetStringRawName16(vn2->vfsSrc.vhstrFileName);
- return (RETERR16)strcmp(file1, file2);
+
+ ret = strcmp(file1, file2);
+ /* Looks too complicated, but in optimized strcpy we might get
+ * a 32bit wide difference and would truncate it to 16 bit, so
+ * erroneously returning equality. */
+ if (ret < 0) return -1;
+ if (ret > 0) return 1;
+ return 0;
}
static RETERR16 VCP_UI_CopyStart(void)
More information about the wine-cvs
mailing list