libutf

UTF-8 library
git clone git://git.suckless.org/libutf
Log | Files | Refs | README | LICENSE

commit ce71fa4415c040d404dd2eee246fe532342035c1
parent 652dd154da45490f9da3a999d9ce62748458fd1c
Author: Connor Lane Smith <cls@lubutu.com>
Date:   Sat, 26 May 2012 00:29:55 +0100

charntorune: avoid potential 32 bit overflow
Diffstat:
rune.c | 4++--
1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/rune.c b/rune.c @@ -81,13 +81,13 @@ charntorune(Rune *p, const char *s, size_t len) return i; } else - r = (r << 6) | (s[i] & 0x3F); + r = (r << 6) | (s[i] & 0x3F); /* 10xxxxxx */ if(i < n) /* must have reached len limit */ return 0; /* reject invalid runes and overlong sequences */ - if(n > UTFmax || runelen(r) < (int)n || BADRUNE(r)) + if(n > 4 || runelen(r) < (int)n || BADRUNE(r)) r = Runeerror; *p = r;