Prevent overflow beyond the end of string in wtf_strwidth()
Bug-Debian: https://github.com/tats/w3m/issues/57
This commit is contained in:
@@ -120,8 +120,9 @@ int
|
||||
wtf_strwidth(wc_uchar *p)
|
||||
{
|
||||
int w = 0;
|
||||
wc_uchar *q = p + strlen(p);
|
||||
|
||||
while (*p) {
|
||||
while (p < q) {
|
||||
w += wtf_width(p);
|
||||
p += WTF_LEN_MAP[*p];
|
||||
}
|
||||
|
Reference in New Issue
Block a user