mirror of
https://github.com/mintycube/st.git
synced 2024-10-22 14:05:49 +02:00
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
Block a user