Bugzilla Bug 326168: fixed an allocation size bug. The patch is NSPR_4_6_BRANCH
authorwtchang%redhat.com
Wed, 12 Apr 2006 00:35:36 +0000
branchNSPR_4_6_BRANCH
changeset 3640 a18e8b335a4ab4a8919326c65c7c6e078989a50f
parent 3634 8e53d2c6d44fffa02d84542cbe8346c6a98c84ea
child 3644 1c3a95f990818178e89cb4db09aefa50548ec89a
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: NSPR_4_6_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)