diff --git a/winsup/cygwin/ChangeLog b/winsup/cygwin/ChangeLog index 73dfe27a6..2e3321a79 100644 --- a/winsup/cygwin/ChangeLog +++ b/winsup/cygwin/ChangeLog @@ -1,3 +1,8 @@ +2010-04-13 John Bowman + + * cygheap.cc (cwcsdup): Fix allocation size to accommodate sizeof WCHAR. + (cwcsdup1): Ditto. + 2010-04-12 Corinna Vinschen * include/cygwin/version.h: Bump DLL minor version number to 5. diff --git a/winsup/cygwin/cygheap.cc b/winsup/cygwin/cygheap.cc index 7c66d736a..f518aa9e5 100644 --- a/winsup/cygwin/cygheap.cc +++ b/winsup/cygwin/cygheap.cc @@ -363,7 +363,7 @@ extern "C" PWCHAR __stdcall cwcsdup (const PWCHAR s) { MALLOC_CHECK; - PWCHAR p = (PWCHAR) cmalloc (HEAP_STR, wcslen (s) + 1); + PWCHAR p = (PWCHAR) cmalloc (HEAP_STR, (wcslen (s) + 1) * sizeof (WCHAR)); if (!p) return NULL; wcpcpy (p, s); @@ -375,7 +375,7 @@ extern "C" PWCHAR __stdcall cwcsdup1 (const PWCHAR s) { MALLOC_CHECK; - PWCHAR p = (PWCHAR) cmalloc (HEAP_1_STR, wcslen (s) + 1); + PWCHAR p = (PWCHAR) cmalloc (HEAP_1_STR, (wcslen (s) + 1) * sizeof (WCHAR)); if (!p) return NULL; wcpcpy (p, s);