aboutsummaryrefslogtreecommitdiffstats
path: root/file.c
diff options
context:
space:
mode:
authorTatsuya Kinoshita <tats@debian.org>2016-12-04 15:31:34 +0000
committerTatsuya Kinoshita <tats@debian.org>2017-01-06 13:01:27 +0000
commite610a5143770268933d5752318eb9d35886b7568 (patch)
tree10a04a9baf18ba8d2ca999e7052105771d145886 /file.c
parentPrevent negative array index for marks in shiftAnchorPosition() (diff)
downloadw3m-e610a5143770268933d5752318eb9d35886b7568.tar.gz
w3m-e610a5143770268933d5752318eb9d35886b7568.zip
Prevent negative array index in getMetaRefreshParam()
Bug-Debian: https://github.com/tats/w3m/issues/63 Origin: https://anonscm.debian.org/cgit/collab-maint/w3m.git/commit/?id=6c6a2cbced21ceec2fac08fba1ad271a77f9dbc2
Diffstat (limited to 'file.c')
-rw-r--r--file.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/file.c b/file.c
index e82eaf1..18b350a 100644
--- a/file.c
+++ b/file.c
@@ -4361,8 +4361,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';
}