Piotr Caban : msvcp90: Fix off by one issue in basic_string::rfind.

Alexandre Julliard julliard at wine.codeweavers.com
Tue Jun 9 08:25:53 CDT 2015


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

Author: Piotr Caban <piotr at codeweavers.com>
Date:   Tue Jun  9 13:49:54 2015 +0200

msvcp90: Fix off by one issue in basic_string::rfind.

---

 dlls/msvcp60/string.c | 8 ++++----
 dlls/msvcp90/string.c | 8 ++++----
 2 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/dlls/msvcp60/string.c b/dlls/msvcp60/string.c
index 229c3ca..76a0e02 100644
--- a/dlls/msvcp60/string.c
+++ b/dlls/msvcp60/string.c
@@ -989,8 +989,8 @@ MSVCP_size_t __thiscall MSVCP_basic_string_char_rfind_cstr_substr(
     if(len > this->size)
         return MSVCP_basic_string_char_npos;
 
-    if(pos > this->size-len+1)
-        pos = this->size-len+1;
+    if(pos > this->size-len)
+        pos = this->size-len;
     end = this->ptr;
     for(p=end+pos; p>=end; p--) {
         if(*p==*find && !MSVCP_char_traits_char_compare(p, find, len))
@@ -2512,8 +2512,8 @@ MSVCP_size_t __thiscall MSVCP_basic_string_wchar_rfind_cstr_substr(
     if(len > this->size)
         return MSVCP_basic_string_wchar_npos;
 
-    if(pos > this->size-len+1)
-        pos = this->size-len+1;
+    if(pos > this->size-len)
+        pos = this->size-len;
     end = this->ptr;
     for(p=end+pos; p>=end; p--) {
         if(*p==*find && !MSVCP_char_traits_wchar_compare(p, find, len))
diff --git a/dlls/msvcp90/string.c b/dlls/msvcp90/string.c
index 3afb375..413e5ff 100644
--- a/dlls/msvcp90/string.c
+++ b/dlls/msvcp90/string.c
@@ -1542,8 +1542,8 @@ MSVCP_size_t __thiscall MSVCP_basic_string_char_rfind_cstr_substr(
     if(len > this->size)
         return MSVCP_basic_string_char_npos;
 
-    if(pos > this->size-len+1)
-        pos = this->size-len+1;
+    if(pos > this->size-len)
+        pos = this->size-len;
     end = basic_string_char_const_ptr(this);
     for(p=end+pos; p>=end; p--) {
         if(*p==*find && !MSVCP_char_traits_char_compare(p, find, len))
@@ -3392,8 +3392,8 @@ MSVCP_size_t __thiscall MSVCP_basic_string_wchar_rfind_cstr_substr(
     if(len > this->size)
         return MSVCP_basic_string_wchar_npos;
 
-    if(pos > this->size-len+1)
-        pos = this->size-len+1;
+    if(pos > this->size-len)
+        pos = this->size-len;
     end = basic_string_wchar_const_ptr(this);
     for(p=end+pos; p>=end; p--) {
         if(*p==*find && !MSVCP_char_traits_wchar_compare(p, find, len))




More information about the wine-cvs mailing list