aboutsummaryrefslogtreecommitdiff
path: root/url-mode.c
diff options
context:
space:
mode:
authorDaniel Eklöf <daniel@ekloef.se>2025-02-10 12:09:07 +0000
committerDaniel Eklöf <daniel@ekloef.se>2025-02-10 12:09:07 +0000
commitc63202ee0ee45182ec5ab440262e63b85104e59e (patch)
tree883bfa9896d187e5cdf31b624d75979829927b90 /url-mode.c
parentdoc: foot.ini: fix 'hashes' regex example (diff)
url-mode: regex: don't try to NULL-terminate an invalid vline
Diffstat (limited to 'url-mode.c')
-rw-r--r--url-mode.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/url-mode.c b/url-mode.c
index 00d38d75..f04550f8 100644
--- a/url-mode.c
+++ b/url-mode.c
@@ -389,8 +389,11 @@ regex_detected(const struct terminal *term, enum url_action action,
}
/* Terminate the last line, if necessary */
- if (vline->len > 0 && vline->utf8[vline->len - 1] != '\0')
+ if (vline_idx < ALEN(vlines) &&
+ vline->len > 0 && vline->utf8[vline->len - 1] != '\0')
+ {
vline->utf8[vline->len++] = '\0';
+ }
for (size_t i = 0; i < ALEN(vlines); i++) {
const struct vline *v = &vlines[i];