Piotr Caban : msvcp60: Fixed overflow in basic_string_char_find_cstr_substr function.

Alexandre Julliard julliard at winehq.org
Wed Oct 17 14:32:27 CDT 2012


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

Author: Piotr Caban <piotr at codeweavers.com>
Date:   Wed Oct 17 10:00:13 2012 +0200

msvcp60: Fixed overflow in basic_string_char_find_cstr_substr function.

---

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

diff --git a/dlls/msvcp60/string.c b/dlls/msvcp60/string.c
index 2bef248..591ffdf 100644
--- a/dlls/msvcp60/string.c
+++ b/dlls/msvcp60/string.c
@@ -826,6 +826,8 @@ MSVCP_size_t __thiscall basic_string_char_find_cstr_substr(
 
     if(len==0 && pos<=this->size)
         return pos;
+    if(pos>=this->size || len>this->size)
+        return basic_string_char_npos;
 
     end = this->ptr+this->size-len+1;
     for(p=this->ptr+pos; p<end; p++) {
@@ -2531,6 +2533,8 @@ MSVCP_size_t __thiscall basic_string_wchar_find_cstr_substr(
 
     if(len==0 && pos<=this->size)
         return pos;
+    if(pos>=this->size || len>this->size)
+        return basic_string_wchar_npos;
 
     end = this->ptr+this->size-len+1;
     for(p=this->ptr+pos; p<end; p++) {




More information about the wine-cvs mailing list