mirror of
https://codeberg.org/dnkl/foot.git
synced 2026-02-05 04:06:08 -05:00
render: limit length of title in call to xdg_toplevel_set_title()
Trying to pass a too long title (not sure what "too long" is though...) will trigger a call to abort() inside the wayland-client library.
This commit is contained in:
parent
bc815a33db
commit
dac1ba18c8
1 changed files with 13 additions and 1 deletions
14
render.c
14
render.c
|
|
@ -950,9 +950,21 @@ render_resize(struct terminal *term, int width, int height)
|
|||
}
|
||||
|
||||
void
|
||||
render_set_title(struct terminal *term, const char *title)
|
||||
render_set_title(struct terminal *term, const char *_title)
|
||||
{
|
||||
/* TODO: figure out what the limit actually is */
|
||||
static const size_t max_len = 100;
|
||||
|
||||
const char *title = _title;
|
||||
char *copy = NULL;
|
||||
|
||||
if (strlen(title) > max_len) {
|
||||
copy = strndup(_title, max_len);
|
||||
title = copy;
|
||||
}
|
||||
|
||||
xdg_toplevel_set_title(term->window->xdg_toplevel, title);
|
||||
free(copy);
|
||||
}
|
||||
|
||||
void
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue