aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTatsuya Kinoshita <tats@debian.org>2016-12-10 13:30:36 +0000
committerTatsuya Kinoshita <tats@debian.org>2017-01-06 13:14:58 +0000
commit7c06ceb2105239edff38e14307cec1ac0ef643aa (patch)
treeb6ad8c3a05dff03943e7227cbe20efc093931496
parentPrevent heap-buffer-overflow in Strnew_size() (diff)
downloadw3m-7c06ceb2105239edff38e14307cec1ac0ef643aa.tar.gz
w3m-7c06ceb2105239edff38e14307cec1ac0ef643aa.zip
Prevent negative array index for realColumn in calcPosition()
Bug-Debian: https://github.com/tats/w3m/issues/69 Origin: https://anonscm.debian.org/cgit/collab-maint/w3m.git/commit/?id=1978455e2ed01699789e8374d29515b74b867b2b
-rw-r--r--etc.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/etc.c b/etc.c
index 8fe1215..af8a5d3 100644
--- a/etc.c
+++ b/etc.c
@@ -498,7 +498,7 @@ calcPosition(char *l, Lineprop *pr, int len, int pos, int bpos, int mode)
static char *prevl = NULL;
int i, j;
- if (l == NULL || len == 0)
+ if (l == NULL || len == 0 || pos < 0)
return bpos;
if (l == prevl && mode == CP_AUTO) {
if (pos <= len)