[PATCH] fixed two coverity issues

Marcus Meissner marcus at jet.franken.de
Tue Feb 5 15:37:09 CST 2008


Hi,

Spotted by Coverity (CID 308), the strlen() was misdetected,
but I replaced it by sizeof() to avoid the misdetected.

Spotted that pTo should also get a double-zeroed string.

Ciao, Marcus
---
 dlls/shell32/tests/shlfileop.c |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/dlls/shell32/tests/shlfileop.c b/dlls/shell32/tests/shlfileop.c
index 247ab76..1e1c378 100644
--- a/dlls/shell32/tests/shlfileop.c
+++ b/dlls/shell32/tests/shlfileop.c
@@ -258,15 +258,15 @@ static void test_delete(void)
 {
     SHFILEOPSTRUCTA shfo;
     DWORD ret;
-    CHAR buf[sizeof(CURR_DIR)+sizeof("/test?.txt")+1];
+    CHAR buf[sizeof(CURR_DIR)+sizeof("/test?.txt")+1+1];
 
     sprintf(buf, "%s\\%s", CURR_DIR, "test?.txt");
-    buf[strlen(buf) + 1] = '\0';
+    buf[sizeof(CURR_DIR)+sizeof("/test?.txt")+ 1] = '\0';
 
     shfo.hwnd = NULL;
     shfo.wFunc = FO_DELETE;
     shfo.pFrom = buf;
-    shfo.pTo = "\0";
+    shfo.pTo = "\0\0";
     shfo.fFlags = FOF_FILESONLY | FOF_NOCONFIRMATION | FOF_SILENT;
     shfo.hNameMappings = NULL;
     shfo.lpszProgressTitle = NULL;
-- 
1.5.2.4



More information about the wine-patches mailing list