diff options
author | Tatsuya Kinoshita <tats@debian.org> | 2016-12-07 16:00:42 +0000 |
---|---|---|
committer | Tatsuya Kinoshita <tats@debian.org> | 2016-12-07 16:00:42 +0000 |
commit | a56a8ef132945512c010cbcbc873dbb42274f9bd (patch) | |
tree | 5b3b1564dd82d721f00e7c10374fa6d4bde839a6 | |
parent | Revert "Prevent overflow beyond the end of string in wtf_strwidth()" (diff) | |
download | w3m-a56a8ef132945512c010cbcbc873dbb42274f9bd.tar.gz w3m-a56a8ef132945512c010cbcbc873dbb42274f9bd.zip |
Prevent overflow beyond the end of string in wtf_strwidth()
Bug-Debian: https://github.com/tats/w3m/issues/57
Diffstat (limited to '')
-rw-r--r-- | libwc/wtf.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/libwc/wtf.c b/libwc/wtf.c index b8cfdc7..83839d7 100644 --- a/libwc/wtf.c +++ b/libwc/wtf.c @@ -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]; } |