aboutsummaryrefslogtreecommitdiffstats
path: root/etc.c
diff options
context:
space:
mode:
authorTatsuya Kinoshita <tats@debian.org>2016-12-10 13:30:36 +0000
committerTatsuya Kinoshita <tats@debian.org>2016-12-10 13:30:36 +0000
commit1978455e2ed01699789e8374d29515b74b867b2b (patch)
tree95d1b5abe82391e9692e17f548013b7ba6ebed38 /etc.c
parentPrevent overflow beyond the end of string in wtf_parse1() (diff)
downloadw3m-1978455e2ed01699789e8374d29515b74b867b2b.tar.gz
w3m-1978455e2ed01699789e8374d29515b74b867b2b.zip
Prevent negative array index for realColumn in calcPosition()
Bug-Debian: https://github.com/tats/w3m/issues/69
Diffstat (limited to 'etc.c')
-rw-r--r--etc.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/etc.c b/etc.c
index dcc6edd..37c4f15 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)