From 2bba259eb77d8f4150ca838a9c2f52ec56a1c931 Mon Sep 17 00:00:00 2001 From: Corinna Vinschen Date: Tue, 13 Apr 2010 10:01:34 +0000 Subject: [PATCH] * cygheap.cc (cwcsdup): Fix allocation size to accommodate sizeof WCHAR. (cwcsdup1): Ditto. --- winsup/cygwin/ChangeLog | 5 +++++ winsup/cygwin/cygheap.cc | 4 ++-- 2 files changed, 7 insertions(+), 2 deletions(-) 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);