From d7f55d5959c3e06e9f110f13def7ae9015882e1e Mon Sep 17 00:00:00 2001 From: Tatsuya Kinoshita Date: Mon, 5 Dec 2016 01:31:30 +0900 Subject: Prevent negative array index in process_textarea() Bug-Debian: https://github.com/tats/w3m/issues/58 --- file.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/file.c b/file.c index ee72a87..50f6b9a 100644 --- a/file.c +++ b/file.c @@ -4012,7 +4012,7 @@ process_textarea(struct parsed_tag *tag, int width) cur_textarea_size = 20; if (parsedtag_get_value(tag, ATTR_COLS, &p)) { cur_textarea_size = atoi(p); - if (p[strlen(p) - 1] == '%') + if (strlen(p) > 0 && p[strlen(p) - 1] == '%') cur_textarea_size = width * cur_textarea_size / 100 - 2; if (cur_textarea_size <= 0) { cur_textarea_size = 20; -- cgit v1.2.3