aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTatsuya Kinoshita <tats@debian.org>2016-12-08 14:43:46 +0000
committerTatsuya Kinoshita <tats@debian.org>2016-12-08 14:46:30 +0000
commita932f78a6d8c105036ffeedf01215c1f6a0e0b71 (patch)
treebb604788ad051b86794400b07074e088f55abd99
parentPrevent overflow beyond the end of string in wtf_strwidth() (diff)
downloadw3m-a932f78a6d8c105036ffeedf01215c1f6a0e0b71.tar.gz
w3m-a932f78a6d8c105036ffeedf01215c1f6a0e0b71.zip
Prevent overflow beyond the end of string in visible_length()
Bug-Debian: https://github.com/tats/w3m/issues/73
-rw-r--r--table.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/table.c b/table.c
index 221db92..d0aed6c 100644
--- a/table.c
+++ b/table.c
@@ -428,8 +428,9 @@ visible_length(char *str)
Str tagbuf = Strnew();
char *t, *r2;
int amp_len = 0;
+ char *strz = str + strlen(str);
- while (*str) {
+ while (str < strz) {
prev_status = status;
if (next_status(*str, &status)) {
#ifdef USE_M17N