From a932f78a6d8c105036ffeedf01215c1f6a0e0b71 Mon Sep 17 00:00:00 2001 From: Tatsuya Kinoshita Date: Thu, 8 Dec 2016 23:43:46 +0900 Subject: Prevent overflow beyond the end of string in visible_length() Bug-Debian: https://github.com/tats/w3m/issues/73 --- table.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) 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 -- cgit v1.2.3