]> git.sur5r.net Git - i3/i3/commitdiff
Bugfix: fix null-pointer dereference when IPC is disabled (Thanks Merovius)
authorMichael Stapelberg <michael@stapelberg.de>
Sat, 19 Mar 2011 20:37:27 +0000 (21:37 +0100)
committerMichael Stapelberg <michael@stapelberg.de>
Sat, 19 Mar 2011 20:37:27 +0000 (21:37 +0100)
src/main.c

index e3b2613ba7c3fa16b4e94419d3ae352a90dfca2e..bde10aac0e0e99081ff39dbe8e79f60d5be0a1a5 100644 (file)
@@ -351,8 +351,11 @@ int main(int argc, char *argv[]) {
     xcb_change_property(conn, XCB_PROP_MODE_REPLACE, root, A__NET_WM_NAME, A_UTF8_STRING, 8, strlen("i3"), "i3");
 
     /* Set up i3 specific atoms like I3_SOCKET_PATH and I3_CONFIG_PATH */
-    xcb_change_property(conn, XCB_PROP_MODE_REPLACE, root, A_I3_SOCKET_PATH, A_UTF8_STRING, 8, strlen(config.ipc_socket_path), config.ipc_socket_path);
-    xcb_change_property(conn, XCB_PROP_MODE_REPLACE, root, A_I3_CONFIG_PATH, A_UTF8_STRING, 8, strlen(saved_configpath), saved_configpath);
+    xcb_change_property(conn, XCB_PROP_MODE_REPLACE, root, A_I3_SOCKET_PATH, A_UTF8_STRING, 8,
+                        (config.ipc_socket_path != NULL ? strlen(config.ipc_socket_path) : 0),
+                        config.ipc_socket_path);
+    xcb_change_property(conn, XCB_PROP_MODE_REPLACE, root, A_I3_CONFIG_PATH, A_UTF8_STRING, 8,
+                        strlen(saved_configpath), saved_configpath);
 
     keysyms = xcb_key_symbols_alloc(conn);