From 7f4533fa496bf18a1278ddf70f8189c0edda2c06 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Wed, 25 Dec 2013 01:20:46 +1100 Subject: [PATCH] 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) --- source/blender/blenlib/intern/string.c | 4 ++-- 1 file 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'; }