From: Michael Stapelberg Date: Fri, 12 Aug 2011 20:53:49 +0000 (+0200) Subject: Bugfix: Use correct buffer size, quote workspace names X-Git-Tag: 4.0.2~43^2~2 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=3892d616cfc3abd395c23c516a55538b82f103c5;p=i3%2Fi3 Bugfix: Use correct buffer size, quote workspace names This fixes problems with the workspace 'next' and workspace names longer than 40 characters --- diff --git a/i3bar/src/xcb.c b/i3bar/src/xcb.c index b8ab5ed2..1afa8bd1 100644 --- a/i3bar/src/xcb.c +++ b/i3bar/src/xcb.c @@ -377,8 +377,9 @@ void handle_button(xcb_button_press_event_t *event) { break; } - char buffer[strlen(cur_ws->name) + 11]; - snprintf(buffer, 50, "workspace %s", cur_ws->name); + const size_t len = strlen(cur_ws->name) + strlen("workspace \"\"") + 1; + char buffer[len]; + snprintf(buffer, len, "workspace \"%s\"", cur_ws->name); i3_send_msg(I3_IPC_MESSAGE_TYPE_COMMAND, buffer); }