From bb93890c7f6776cf9d28935e93153fe3c3cbb064 Mon Sep 17 00:00:00 2001 From: Karl Williamson Date: Sun, 6 Nov 2016 02:05:41 +0100 Subject: utf8.c: No need to look at trailing NUL in comparing string I meant to get this into commit b0b342d4b3fa61880a96b645a3dab648f7c4c682, but didn't. Subtract 1 from the sizeof a constant string to get the number of bytes to compare, as we don't need to look at the trailing NUL. --- utf8.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'utf8.c') diff --git a/utf8.c b/utf8.c index 8b301b26f8..d75757749a 100644 --- a/utf8.c +++ b/utf8.c @@ -452,7 +452,7 @@ S_does_utf8_overflow(const U8 * const s, const U8 * e) if (isFF_OVERLONG(s, e - s)) { const U8 max_32_bit_overlong[] = "\xFF\x80\x80\x80\x80\x80\x80\x84"; return memGE(s, max_32_bit_overlong, - MIN(e - s, sizeof(max_32_bit_overlong))); + MIN(e - s, sizeof(max_32_bit_overlong) - 1)); } #endif -- cgit v1.2.1