From be3e7dec7e19a8ddc527a188306c097900a6da99 Mon Sep 17 00:00:00 2001 From: Mattias Andrée Date: Sat, 24 Jan 2026 17:27:23 +0100 Subject: Add bracketed MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Mattias Andrée --- libcharconv_decode_utf8_.c | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'libcharconv_decode_utf8_.c') diff --git a/libcharconv_decode_utf8_.c b/libcharconv_decode_utf8_.c index db66040..7b488e3 100644 --- a/libcharconv_decode_utf8_.c +++ b/libcharconv_decode_utf8_.c @@ -1,5 +1,7 @@ /* See LICENSE file for copyright and license details. */ #include "lib-common.h" +#include +#include size_t @@ -37,6 +39,8 @@ libcharconv_decode_utf8_(const char *s, size_t slen, uint_least32_t *cp) return n; for (i = 1u; i < n; i++) { + if ((s[i] & 0xC0) != 0x80) + return 0u; *cp <<= 6; *cp |= (uint_least32_t)s[i] & 0x3Fu; } -- cgit v1.2.3-70-g09d2