diff options
author | Tatsuya Kinoshita <tats@debian.org> | 2016-12-04 15:31:34 +0000 |
---|---|---|
committer | Tatsuya Kinoshita <tats@debian.org> | 2016-12-05 12:48:08 +0000 |
commit | 6c6a2cbced21ceec2fac08fba1ad271a77f9dbc2 (patch) | |
tree | aa17bf527dd25b9c0cf7c6dc02d083a50ac7b4be | |
parent | Prevent negative array index for marks in shiftAnchorPosition() (diff) | |
download | w3m-6c6a2cbced21ceec2fac08fba1ad271a77f9dbc2.tar.gz w3m-6c6a2cbced21ceec2fac08fba1ad271a77f9dbc2.zip |
Prevent negative array index in getMetaRefreshParam()
Bug-Debian: https://github.com/tats/w3m/issues/63
-rw-r--r-- | file.c | 5 |
1 files changed, 3 insertions, 2 deletions
@@ -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'; } |