Avoid integer overflows with very long strings

This commit is contained in:
Petri Lehtinen
2013-10-15 08:44:04 +03:00
parent 8dc3233f3b
commit d544852ff6
2 changed files with 8 additions and 1 deletions

View File

@@ -173,7 +173,7 @@ int utf8_check_string(const char *string, size_t length)
return 0;
else if(count > 1)
{
if(i + count > length)
if(count > length - i)
return 0;
if(!utf8_check_full(&string[i], count, NULL))