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:
parent
e1b322b250
commit
7f4533fa49
|
@ -582,7 +582,7 @@ void BLI_ascii_strtolower(char *str, const size_t len)
|
||||||
{
|
{
|
||||||
size_t i;
|
size_t i;
|
||||||
|
|
||||||
for (i = 0; i < len; i++)
|
for (i = 0; (i < len) && str[i]; i++)
|
||||||
if (str[i] >= 'A' && str[i] <= 'Z')
|
if (str[i] >= 'A' && str[i] <= 'Z')
|
||||||
str[i] += 'a' - 'A';
|
str[i] += 'a' - 'A';
|
||||||
}
|
}
|
||||||
|
@ -591,7 +591,7 @@ void BLI_ascii_strtoupper(char *str, const size_t len)
|
||||||
{
|
{
|
||||||
size_t i;
|
size_t i;
|
||||||
|
|
||||||
for (i = 0; i < len; i++)
|
for (i = 0; (i < len) && str[i]; i++)
|
||||||
if (str[i] >= 'a' && str[i] <= 'z')
|
if (str[i] >= 'a' && str[i] <= 'z')
|
||||||
str[i] -= 'a' - 'A';
|
str[i] -= 'a' - 'A';
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue