jscript: Do not call memcpy() with a NULL pointer argument (Try 2)

Andrew Talbot andrew.talbot at talbotville.com
Sat Dec 20 12:09:59 CST 2008


Changelog:
    jscript: Do not call memcpy() with a NULL pointer argument.

diff --git a/dlls/jscript/string.c b/dlls/jscript/string.c
index eeceb1f..eb497f3 100644
--- a/dlls/jscript/string.c
+++ b/dlls/jscript/string.c
@@ -1395,7 +1395,8 @@ HRESULT create_string(script_ctx_t *ctx, const WCHAR *str, DWORD len, DispatchEx
         return E_OUTOFMEMORY;
     }
 
-    memcpy(string->str, str, len*sizeof(WCHAR));
+    if (len > 0)
+        memcpy(string->str, str, len*sizeof(WCHAR));
     string->str[len] = 0;
 
     *ret = &string->dispex;



More information about the wine-patches mailing list