Commit 1b6dfafc authored by Piotr Caban's avatar Piotr Caban Committed by Alexandre Julliard

msvcp60: Fixed overflow in basic_string_char_find_cstr_substr function.

parent 8de45a3d
...@@ -826,6 +826,8 @@ MSVCP_size_t __thiscall basic_string_char_find_cstr_substr( ...@@ -826,6 +826,8 @@ MSVCP_size_t __thiscall basic_string_char_find_cstr_substr(
if(len==0 && pos<=this->size) if(len==0 && pos<=this->size)
return pos; return pos;
if(pos>=this->size || len>this->size)
return basic_string_char_npos;
end = this->ptr+this->size-len+1; end = this->ptr+this->size-len+1;
for(p=this->ptr+pos; p<end; p++) { for(p=this->ptr+pos; p<end; p++) {
...@@ -2531,6 +2533,8 @@ MSVCP_size_t __thiscall basic_string_wchar_find_cstr_substr( ...@@ -2531,6 +2533,8 @@ MSVCP_size_t __thiscall basic_string_wchar_find_cstr_substr(
if(len==0 && pos<=this->size) if(len==0 && pos<=this->size)
return pos; return pos;
if(pos>=this->size || len>this->size)
return basic_string_wchar_npos;
end = this->ptr+this->size-len+1; end = this->ptr+this->size-len+1;
for(p=this->ptr+pos; p<end; p++) { for(p=this->ptr+pos; p<end; p++) {
......
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