Marcus Meissner : xcopy: Handle return from vsnprintfW (Coverity).

Alexandre Julliard julliard at winehq.org
Thu Jan 29 09:15:21 CST 2009


Module: wine
Branch: master
Commit: 1db4c5dc67e6754bad0bee3a442d639ecd80c97f
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=1db4c5dc67e6754bad0bee3a442d639ecd80c97f

Author: Marcus Meissner <marcus at jet.franken.de>
Date:   Wed Jan 28 23:40:56 2009 +0100

xcopy: Handle return from vsnprintfW (Coverity).

---

 programs/xcopy/xcopy.c |    7 ++++++-
 1 files changed, 6 insertions(+), 1 deletions(-)

diff --git a/programs/xcopy/xcopy.c b/programs/xcopy/xcopy.c
index e89c404..eaff10c 100644
--- a/programs/xcopy/xcopy.c
+++ b/programs/xcopy/xcopy.c
@@ -984,7 +984,8 @@ int XCOPY_wprintf(const WCHAR *format, ...) {
 #define MAX_WRITECONSOLE_SIZE 65535
 
     va_list parms;
-    DWORD   len, nOut;
+    DWORD   nOut;
+    int len;
     DWORD   res = 0;
 
     /*
@@ -1003,6 +1004,10 @@ int XCOPY_wprintf(const WCHAR *format, ...) {
     va_start(parms, format);
     len = vsnprintfW(output_bufW, MAX_WRITECONSOLE_SIZE/sizeof(WCHAR), format, parms);
     va_end(parms);
+    if (len < 0) {
+      WINE_FIXME("String too long.\n");
+      return 0;
+    }
 
     /* Try to write as unicode all the time we think its a console */
     if (toConsole) {




More information about the wine-cvs mailing list