Merge pull request #496 from JeffProgrammer/getWords_buffer_fix

Fix buffer overflow issue in StringUnit::getWords
This commit is contained in:
Brian Roberts 2021-06-18 23:10:21 -05:00 committed by GitHub
commit 802598766a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -42,7 +42,7 @@ namespace StringUnit
buffer[0] = 0;
U32 sz;
dsize_t sz;
while(index--)
{
if(!*string)
@ -71,7 +71,7 @@ namespace StringUnit
if( startIndex > endIndex )
return "";
S32 sz;
dsize_t sz;
S32 index = startIndex;
while(index--)
{
@ -89,7 +89,7 @@ namespace StringUnit
sz = dStrcspn(string, set);
string += sz;
if( i < endIndex )
if( i < endIndex && *string )
string ++;
}