Piotr Caban : msvcp90: Fixed buffer allocation in basic_stringbuf<wchar> class.

Alexandre Julliard julliard at winehq.org
Mon Aug 20 14:16:17 CDT 2012


Module: wine
Branch: master
Commit: e40d02868d26a402abc8402299daccd2d6a2f5bb
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=e40d02868d26a402abc8402299daccd2d6a2f5bb

Author: Piotr Caban <piotr at codeweavers.com>
Date:   Sat Aug 18 14:54:17 2012 +0200

msvcp90: Fixed buffer allocation in basic_stringbuf<wchar> class.

---

 dlls/msvcp100/ios.c |    4 ++--
 dlls/msvcp90/ios.c  |    4 ++--
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/dlls/msvcp100/ios.c b/dlls/msvcp100/ios.c
index 1bc8ee2..4969c7b 100644
--- a/dlls/msvcp100/ios.c
+++ b/dlls/msvcp100/ios.c
@@ -3946,7 +3946,7 @@ void __thiscall basic_stringbuf_wchar__Init(basic_stringbuf_wchar *this, const w
     this->seekhigh = NULL;
 
     if(count && str) {
-        wchar_t *buf = MSVCRT_operator_new(count);
+        wchar_t *buf = MSVCRT_operator_new(count*sizeof(wchar_t));
         if(!buf) {
             ERR("Out of memory\n");
             throw_exception(EXCEPTION_BAD_ALLOC, NULL);
@@ -4120,7 +4120,7 @@ unsigned short __thiscall basic_stringbuf_wchar_overflow(basic_stringbuf_wchar *
     oldsize = (ptr ? basic_streambuf_wchar_epptr(&this->base)-basic_streambuf_wchar_eback(&this->base): 0);
     size = oldsize|0xf;
     size += size/2;
-    buf = MSVCRT_operator_new(size);
+    buf = MSVCRT_operator_new(size*sizeof(wchar_t));
     if(!buf) {
         ERR("Out of memory\n");
         throw_exception(EXCEPTION_BAD_ALLOC, NULL);
diff --git a/dlls/msvcp90/ios.c b/dlls/msvcp90/ios.c
index a0e54ad..fd2f6a7 100644
--- a/dlls/msvcp90/ios.c
+++ b/dlls/msvcp90/ios.c
@@ -3932,7 +3932,7 @@ void __thiscall basic_stringbuf_wchar__Init(basic_stringbuf_wchar *this, const w
     this->seekhigh = NULL;
 
     if(count && str) {
-        wchar_t *buf = MSVCRT_operator_new(count);
+        wchar_t *buf = MSVCRT_operator_new(count*sizeof(wchar_t));
         if(!buf) {
             ERR("Out of memory\n");
             throw_exception(EXCEPTION_BAD_ALLOC, NULL);
@@ -4106,7 +4106,7 @@ unsigned short __thiscall basic_stringbuf_wchar_overflow(basic_stringbuf_wchar *
     oldsize = (ptr ? basic_streambuf_wchar_epptr(&this->base)-basic_streambuf_wchar_eback(&this->base): 0);
     size = oldsize|0xf;
     size += size/2;
-    buf = MSVCRT_operator_new(size);
+    buf = MSVCRT_operator_new(size*sizeof(wchar_t));
     if(!buf) {
         ERR("Out of memory\n");
         throw_exception(EXCEPTION_BAD_ALLOC, NULL);




More information about the wine-cvs mailing list