String API: BLI_ascii_strtolower/upper now check NULL terminator
This wasn't needed before now, but since recent change to bUnit_ReplaceString, it uses in a context where NULL terminator is expected - best add. (spotted by Sergey)
This commit is contained in:
@@ -582,7 +582,7 @@ void BLI_ascii_strtolower(char *str, const size_t len)
|
||||
{
|
||||
size_t i;
|
||||
|
||||
for (i = 0; i < len; i++)
|
||||
for (i = 0; (i < len) && str[i]; i++)
|
||||
if (str[i] >= 'A' && str[i] <= 'Z')
|
||||
str[i] += 'a' - 'A';
|
||||
}
|
||||
@@ -591,7 +591,7 @@ void BLI_ascii_strtoupper(char *str, const size_t len)
|
||||
{
|
||||
size_t i;
|
||||
|
||||
for (i = 0; i < len; i++)
|
||||
for (i = 0; (i < len) && str[i]; i++)
|
||||
if (str[i] >= 'a' && str[i] <= 'z')
|
||||
str[i] -= 'a' - 'A';
|
||||
}
|
||||
|
Reference in New Issue
Block a user