Skip to content
Snippets Groups Projects
Commit 7f4533fa authored by Campbell Barton's avatar Campbell Barton
Browse files

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)
parent e1b322b2
Branches
No related tags found
No related merge requests found
...@@ -582,7 +582,7 @@ void BLI_ascii_strtolower(char *str, const size_t len) ...@@ -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) ...@@ -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';
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment