Piotr Caban : msvcp60: Copy correct number of characters in basic_string:: _Grow.

Alexandre Julliard julliard at winehq.org
Mon Oct 22 13:42:45 CDT 2012


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

Author: Piotr Caban <piotr at codeweavers.com>
Date:   Mon Oct 22 17:15:49 2012 +0200

msvcp60: Copy correct number of characters in basic_string::_Grow.

---

 dlls/msvcp60/string.c |   14 ++++++++++----
 1 files changed, 10 insertions(+), 4 deletions(-)

diff --git a/dlls/msvcp60/string.c b/dlls/msvcp60/string.c
index 591ffdf..ed4391c 100644
--- a/dlls/msvcp60/string.c
+++ b/dlls/msvcp60/string.c
@@ -203,13 +203,16 @@ MSVCP_bool __thiscall basic_string_char__Grow(basic_string_char *this, MSVCP_siz
             return FALSE;
         }
 
+        if(len > new_res)
+            len = new_res;
+
         *ptr = 0;
         if(this->ptr)
-            char_traits_char__Copy_s(ptr+1, new_size, this->ptr, this->size);
+            char_traits_char__Copy_s(ptr+1, new_size, this->ptr, len);
         basic_string_char__Tidy(this, TRUE);
         this->ptr = ptr+1;
         this->res = new_res;
-        basic_string_char__Eos(this, len>new_res ? new_res : len);
+        basic_string_char__Eos(this, len);
     }
 
     return new_size>0;
@@ -1911,13 +1914,16 @@ MSVCP_bool __thiscall basic_string_wchar__Grow(basic_string_wchar *this, MSVCP_s
             return FALSE;
         }
 
+        if(len > new_res)
+            len = new_res;
+
         *ptr = 0;
         if(this->ptr)
-            char_traits_wchar__Copy_s(ptr+1, new_size, this->ptr, this->size);
+            char_traits_wchar__Copy_s(ptr+1, new_size, this->ptr, len);
         basic_string_wchar__Tidy(this, TRUE);
         this->ptr = ptr+1;
         this->res = new_res;
-        basic_string_wchar__Eos(this, len>new_res ? new_res : len);
+        basic_string_wchar__Eos(this, len);
     }
 
     return new_size>0;




More information about the wine-cvs mailing list