]> git.sur5r.net Git - i3/i3/commitdiff
Bugfix: Use correct buffer size, quote workspace names
authorMichael Stapelberg <michael@stapelberg.de>
Fri, 12 Aug 2011 20:53:49 +0000 (22:53 +0200)
committerMichael Stapelberg <michael@stapelberg.de>
Fri, 12 Aug 2011 20:57:02 +0000 (22:57 +0200)
This fixes problems with the workspace 'next' and workspace names longer than
40 characters

i3bar/src/xcb.c

index b8ab5ed2e3b9af28d77a29a93a17aac88d167322..1afa8bd150c59d37595aa14d259822baf4b55901 100644 (file)
@@ -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);
 }