Prevent dereference near-null pointer in formUpdateBuffer

Bug-Debian: https://github.com/tats/w3m/issues/35
This commit is contained in:
Tatsuya Kinoshita
2016-11-07 19:21:22 +09:00
parent af592aa5f1
commit e2c7ecec6f

3
form.c
View File

@@ -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] = '*';