aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTatsuya Kinoshita <tats@debian.org>2016-11-07 10:21:22 +0000
committerTatsuya Kinoshita <tats@debian.org>2016-11-07 10:21:22 +0000
commite2c7ecec6f9b730ad3c9bf8c8df9212970f183d7 (patch)
treec58c13c86830a65220c2ccbc1047a0132d04ddf4
parentPrevent crash after allocate string of negative size (diff)
downloadw3m-e2c7ecec6f9b730ad3c9bf8c8df9212970f183d7.tar.gz
w3m-e2c7ecec6f9b730ad3c9bf8c8df9212970f183d7.zip
Prevent dereference near-null pointer in formUpdateBuffer
Bug-Debian: https://github.com/tats/w3m/issues/35
Diffstat (limited to '')
-rw-r--r--form.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/form.c b/form.c
index de7a4d9..1aaaf19d 100644
--- a/form.c
+++ b/form.c
@@ -442,7 +442,8 @@ formUpdateBuffer(Anchor *a, Buffer *buf, FormItemList *form)
switch (form->type) {
case FORM_INPUT_CHECKBOX:
case FORM_INPUT_RADIO:
- if (spos >= buf->currentLine->len || spos < 0)
+ if (buf->currentLine == NULL ||
+ spos >= buf->currentLine->len || spos < 0)
break;
if (form->checked)
buf->currentLine->lineBuf[spos] = '*';