From 971b2f11f9336c220870fa7504999e0fa5fe266a Mon Sep 17 00:00:00 2001 From: Dominique Martinet Date: Sun, 1 Jul 2018 23:14:43 +0900 Subject: [PATCH] utf8_size: fix loop boundary Found through static analysis --- common/unicode.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/common/unicode.c b/common/unicode.c index 38a9b48eb..5070e0835 100644 --- a/common/unicode.c +++ b/common/unicode.c @@ -92,7 +92,7 @@ static const struct { int utf8_size(const char *s) { uint8_t c = (uint8_t)*s; - for (size_t i = 0; i < sizeof(sizes) / 2; ++i) { + for (size_t i = 0; i < sizeof(sizes) / sizeof(*sizes); ++i) { if ((c & sizes[i].mask) == sizes[i].result) { return sizes[i].octets; }