From 5d944dfe9f03c9fb43271199d2ba4b8880747614 Mon Sep 17 00:00:00 2001 From: David Date: Sat, 30 Nov 2013 09:14:45 +1300 Subject: Bugfixes in strlen() which used to handle zero-length strings incorrectly --- string/common.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'string') diff --git a/string/common.c b/string/common.c index 6edce1a..b9adc3e 100644 --- a/string/common.c +++ b/string/common.c @@ -24,8 +24,8 @@ uint64_t strlen(const char *string) { uint64_t l = 0; - while (string[++l] != 0); - return l; + while (string[l++]); + return l-1; } bool itoa(uint32_t num, char *buffer, uint8_t base) -- cgit v1.1