Bugzilla Bug 326168: fixed an allocation size bug. The patch is NSPRPUB_PRE_4_2_CLIENT_BRANCH
authorwtchang%redhat.com
Wed, 12 Apr 2006 00:33:59 +0000
branchNSPRPUB_PRE_4_2_CLIENT_BRANCH
changeset 3639 b370d2afc4000fe5961e8a952f47c5cfdf865b57
parent 3637 0e3c2ab89bb799e639b5f9438719972cc603284d
child 3646 6db96d346238a0d9a9c71e9775e6117eb0258473
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: NSPRPUB_PRE_4_2_CLIENT_BRANCH
pr/src/linking/prlink.c
--- a/pr/src/linking/prlink.c
+++ b/pr/src/linking/prlink.c
@@ -830,17 +830,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)