Bugzilla Bug 326168: fixed an allocation size bug. The patch is
authorwtchang%redhat.com
Wed, 12 Apr 2006 00:33:06 +0000
changeset 3638 a853bcaa27acb84b3655b4b2c478d087148b08ad
parent 3636 a43edfd07b9d6a16bb7023bcf7029c7bd444c652
child 3647 a1cd2cd995f611323f0a28c9f36531818e05338d
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.
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)