From: Piotr Caban Subject: msvcp90: Fix off by one issue in basic_string::rfind Message-Id: <5576D2E2.7080201@codeweavers.com> Date: Tue, 09 Jun 2015 13:49:54 +0200 --- 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))