From 3979dd45fb1088cc27bcde72f0d4a51c80035e4f Mon Sep 17 00:00:00 2001 From: Owen Shepherd Date: Sat, 25 Aug 2012 20:03:06 +0100 Subject: [PATCH] strnlen: stupid off-by-one --- functions/string/strnlen.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/functions/string/strnlen.c b/functions/string/strnlen.c index e7eab57..c5012e2 100644 --- a/functions/string/strnlen.c +++ b/functions/string/strnlen.c @@ -16,7 +16,7 @@ size_t strnlen( const char * s, size_t maxlen ) for( size_t len = 0; len != maxlen; len++ ) { if(s[len] == '\0') - return len - 1; + return len; } return maxlen; } -- 2.40.0