mirror of
https://codeberg.org/dnkl/foot.git
synced 2026-04-13 08:21:03 -04:00
term: ignore attempts to set a title that contains an invalid UTF-8 sequence
Setting the title ultimately leads to a call to
xdg_toplevel::set_title(). It is a protocol violation to try to set a
title that contains an invalid UTF-8 sequence:
The string must be encoded in UTF-8.
Closes #1552
This commit is contained in:
parent
756da87346
commit
316136f428
2 changed files with 10 additions and 0 deletions
|
|
@ -3249,6 +3249,13 @@ term_set_window_title(struct terminal *term, const char *title)
|
|||
if (term->window_title != NULL && streq(term->window_title, title))
|
||||
return;
|
||||
|
||||
if (mbsntoc32(NULL, title, strlen(title), 0) == (char32_t)-1) {
|
||||
/* It's an xdg_toplevel::set_title() protocol violation to set
|
||||
a title with an invalid UTF-8 sequence */
|
||||
LOG_WARN("%s: title is not valid UTF-8, ignoring", title);
|
||||
return;
|
||||
}
|
||||
|
||||
free(term->window_title);
|
||||
term->window_title = xstrdup(title);
|
||||
render_refresh_title(term);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue