[Bf-blender-cvs] [7f4533f] master: String API: BLI_ascii_strtolower/upper now check NULL terminator
Campbell Barton
noreply at git.blender.org
Tue Dec 24 15:24:48 CET 2013
Commit: 7f4533fa496bf18a1278ddf70f8189c0edda2c06
Author: Campbell Barton
Date: Wed Dec 25 01:20:46 2013 +1100
http://developer.blender.org/rB7f4533fa496bf18a1278ddf70f8189c0edda2c06
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)
===================================================================
M source/blender/blenlib/intern/string.c
===================================================================
diff --git a/source/blender/blenlib/intern/string.c b/source/blender/blenlib/intern/string.c
index 572b142..0ce40f7 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';
}
More information about the Bf-blender-cvs
mailing list