mirror of
https://codeberg.org/dnkl/foot.git
synced 2026-02-05 04:06:08 -05:00
url-mode: terminate last virtual line before regex matching
If the last line doesn't have a hard linebreak, it was never NULL terminated, causing regexec() to crash on an out-of-bounds access.
This commit is contained in:
parent
4e5ad6e013
commit
98db965813
1 changed files with 5 additions and 1 deletions
|
|
@ -388,10 +388,14 @@ 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')
|
||||
vline->utf8[vline->len++] = '\0';
|
||||
|
||||
for (size_t i = 0; i < ALEN(vlines); i++) {
|
||||
const struct vline *v = &vlines[i];
|
||||
if (v->utf8 == NULL)
|
||||
continue;;
|
||||
continue;
|
||||
|
||||
const char *search_string = v->utf8;
|
||||
while (true) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue