diff options
author | Campbell Barton <ideasman42@gmail.com> | 2013-12-24 18:20:46 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2013-12-24 18:20:46 +0400 |
commit | 7f4533fa496bf18a1278ddf70f8189c0edda2c06 (patch) | |
tree | 9d3fe0421c7205b9a60d97b2d9c87e2afe2bfc53 /source/blender/blenlib/intern/string.c | |
parent | e1b322b250c5b6e34e0c2118ee25aa4542442dcd (diff) |
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)
Diffstat (limited to 'source/blender/blenlib/intern/string.c')
-rw-r--r-- | source/blender/blenlib/intern/string.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/source/blender/blenlib/intern/string.c b/source/blender/blenlib/intern/string.c index 572b142d044..0ce40f717d4 100644 --- a/source/blender/blenlib/intern/string.c +++ b/source/blender/blenlib/intern/string.c @@ -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'; } |