aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTatsuya Kinoshita <tats@debian.org>2016-12-04 16:31:30 +0000
committerTatsuya Kinoshita <tats@debian.org>2017-01-06 13:04:01 +0000
commitdff9adbdf61dd23f6873286f8959c8fc9c50d684 (patch)
treeb2ba56d7b3a0e1543df0c022f742d81d90c51a6a
parentPrevent negative array index for marks in HTMLlineproc2body() (diff)
downloadw3m-dff9adbdf61dd23f6873286f8959c8fc9c50d684.tar.gz
w3m-dff9adbdf61dd23f6873286f8959c8fc9c50d684.zip
Prevent negative array index in process_textarea()
Bug-Debian: https://github.com/tats/w3m/issues/58 Origin: https://anonscm.debian.org/cgit/collab-maint/w3m.git/commit/?id=d7f55d5959c3e06e9f110f13def7ae9015882e1e
-rw-r--r--file.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/file.c b/file.c
index c5aeb88..330ae3a 100644
--- a/file.c
+++ b/file.c
@@ -3995,7 +3995,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;