Streamline validation in utf8decode()
https://lists.suckless.org/hackers/2207/18407.html
This commit is contained in:
parent
6d5c2b3ddb
commit
d78d582eaa
4
st.c
4
st.c
|
@ -313,8 +313,8 @@ utf8decode(const char *c, Rune *u, size_t clen)
|
||||||
}
|
}
|
||||||
if (j < len)
|
if (j < len)
|
||||||
return 0;
|
return 0;
|
||||||
*u = udecoded;
|
*u = (!BETWEEN(udecoded, utfmin[len], utfmax[len]) || BETWEEN(udecoded, 0xD800, 0xDFFF))
|
||||||
utf8validate(u, len);
|
? UTF_INVALID : udecoded;
|
||||||
|
|
||||||
return len;
|
return len;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue