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

Andrew Talbot andrew.talbot at talbotville.com
Thu Dec 18 16:21:07 CST 2008


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

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



More information about the wine-patches mailing list