Commit a0e8d62a authored by Piotr Caban's avatar Piotr Caban Committed by Alexandre Julliard

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

parent 4f15cc4d
......@@ -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))
......
......@@ -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))
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment