Bugzilla Bug 326168: fixed an allocation size bug. The patch is MOZILLA_1_8_BRANCH NSPRPUB_WINCE_04122006_BASE
authorwtchang%redhat.com
Wed, 12 Apr 2006 00:36:54 +0000
branchMOZILLA_1_8_BRANCH
changeset 3641 cefbc48dc08e81c8f68d472b3ba41fca74de4165
parent 3635 b2ab2e0c204e893c9011f4afeb55596b9c459e47
child 3642 a1b74d1f5c803d0d336d72dd56c205848fbe69de
child 3645 a478ea064179191ce0f5f72901615b7768b9edc0
push idunknown
push userunknown
push dateunknown
bugs326168
Bugzilla Bug 326168: fixed an allocation size bug. The patch is contributed by neil@parkwaycc.co.uk. r=wtc. Tag: MOZILLA_1_8_BRANCH
pr/src/linking/prlink.c
--- a/pr/src/linking/prlink.c
+++ b/pr/src/linking/prlink.c
@@ -822,17 +822,17 @@ pr_LoadLibraryByPathname(const char *nam
 
 #ifdef WIN32
     if (flags & PR_LD_PATHW) {
         /* cast back what's cast to |char *| for the argument passing. */
         wname = (LPWSTR) name;
     } else {
         int wlen = MultiByteToWideChar(CP_ACP, 0, name, -1, NULL, 0);
         if (wlen > MAX_PATH)
-            wname = wname_malloc = PR_Malloc(wlen);
+            wname = wname_malloc = PR_Malloc(wlen * sizeof(PRUnichar));
         if (wname == NULL ||
             !MultiByteToWideChar(CP_ACP, 0,  name, -1, wname, wlen)) {
             oserr = _MD_ERRNO();
             goto unlock;
         }
     }
     len = pr_ConvertUTF16toUTF8(wname, NULL, 0);
     if (len > MAX_PATH)