Prevent segfault with malformed input type

Bug-Debian: https://github.com/tats/w3m/issues/7
This commit is contained in:
Tatsuya Kinoshita
2016-08-09 00:02:24 +09:00
parent 222a313905
commit 59b91cd8e3

10
file.c
View File

@@ -3639,9 +3639,10 @@ process_input(struct parsed_tag *tag)
Strcat(tmp, getLinkNumberStr(0));
Strcat_char(tmp, '(');
}
Strcat(tmp, Sprintf("<input_alt hseq=\"%d\" fid=\"%d\" type=%s "
Strcat(tmp, Sprintf("<input_alt hseq=\"%d\" fid=\"%d\" type=\"%s\" "
"name=\"%s\" width=%d maxlength=%d value=\"%s\"",
cur_hseq++, cur_form_id, p, html_quote(r), size, i, qq));
cur_hseq++, cur_form_id, html_quote(p),
html_quote(r), size, i, qq));
if (x)
Strcat_charp(tmp, " checked");
if (y)
@@ -3789,9 +3790,10 @@ process_button(struct parsed_tag *tag)
}
/* Strcat_charp(tmp, "<pre_int>"); */
Strcat(tmp, Sprintf("<input_alt hseq=\"%d\" fid=\"%d\" type=%s "
Strcat(tmp, Sprintf("<input_alt hseq=\"%d\" fid=\"%d\" type=\"%s\" "
"name=\"%s\" value=\"%s\">",
cur_hseq++, cur_form_id, p, html_quote(r), qq));
cur_hseq++, cur_form_id, html_quote(p),
html_quote(r), qq));
return tmp;
}