summaryrefslogtreecommitdiff
path: root/utf8.c
diff options
context:
space:
mode:
authorKarl Williamson <khw@cpan.org>2016-11-06 02:05:41 +0100
committerKarl Williamson <khw@cpan.org>2016-11-06 02:07:35 +0100
commitbb93890c7f6776cf9d28935e93153fe3c3cbb064 (patch)
tree0f42322a42ab3c36433cc1219b0888d3fb160e3a /utf8.c
parent86db16b80af61d0f0d083707c76bef013130caa7 (diff)
downloadperl-bb93890c7f6776cf9d28935e93153fe3c3cbb064.tar.gz
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.
Diffstat (limited to 'utf8.c')
-rw-r--r--utf8.c2
1 files changed, 1 insertions, 1 deletions
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