Prevent negative array index in getMetaRefreshParam()

Bug-Debian: https://github.com/tats/w3m/issues/63
This commit is contained in:
Tatsuya Kinoshita
2016-12-05 00:31:34 +09:00
parent d57c13282a
commit 6c6a2cbced
+3 -2
View File
@@ -4378,8 +4378,9 @@ getMetaRefreshParam(char *q, Str *refresh_uri)
r++;
s_tmp = Strnew_charp_n(q, r - q);
if (s_tmp->ptr[s_tmp->length - 1] == '\"' /* " */
|| s_tmp->ptr[s_tmp->length - 1] == '\'') { /* ' */
if (s_tmp->length > 0 &&
(s_tmp->ptr[s_tmp->length - 1] == '\"' || /* " */
s_tmp->ptr[s_tmp->length - 1] == '\'')) { /* ' */
s_tmp->length--;
s_tmp->ptr[s_tmp->length] = '\0';
}