aboutsummaryrefslogtreecommitdiff
path: root/render.c
diff options
context:
space:
mode:
authorDaniel Eklöf <daniel@ekloef.se>2019-11-01 19:25:44 +0000
committerDaniel Eklöf <daniel@ekloef.se>2019-11-01 19:25:44 +0000
commitdac1ba18c8e97e2a726a83e1cddc1c8f2a40468d (patch)
treee7ada71dbaef04ab2c63a3623f4367b0a3199f14 /render.c
parentwayland: wayl_destroy(): destroy any remaining terminals (diff)
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.
Diffstat (limited to 'render.c')
-rw-r--r--render.c14
1 files changed, 13 insertions, 1 deletions
diff --git a/render.c b/render.c
index b58eb7dc..2386e073 100644
--- a/render.c
+++ b/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