diff --git a/awesome.c b/awesome.c index 49785afe2..af5c24466 100644 --- a/awesome.c +++ b/awesome.c @@ -409,8 +409,8 @@ main(int argc, char **argv) /* init default font and colors */ globalconf.font = draw_font_new(globalconf.connection, globalconf.default_screen, "sans 8"); - xcolor_init(&globalconf.colors.fg, globalconf.connection, globalconf.default_screen, "black", sizeof("black")); - xcolor_init(&globalconf.colors.bg, globalconf.connection, globalconf.default_screen, "white", sizeof("white")); + xcolor_init(&globalconf.colors.fg, globalconf.connection, globalconf.default_screen, "black", sizeof("black")-1); + xcolor_init(&globalconf.colors.bg, globalconf.connection, globalconf.default_screen, "white", sizeof("white")-1); /* init cursors */ globalconf.cursor[CurNormal] = xutil_cursor_new(globalconf.connection, CURSOR_LEFT_PTR); diff --git a/common/socket.c b/common/socket.c index 4c4b7e0aa..5070defb3 100644 --- a/common/socket.c +++ b/common/socket.c @@ -58,7 +58,7 @@ socket_getaddr(const char *display) /* a_strlen(display) because we strcat on display and * + 2 for / and \0 */ - path_len = a_strlen(homedir) + sizeof(CONTROL_UNIX_SOCKET_PATH) + path_len = a_strlen(homedir) + sizeof(CONTROL_UNIX_SOCKET_PATH)-1 + (display_len ? (a_strlen(real_display)) : 1) + 2; if(path_len >= ssizeof(addr->sun_path)) diff --git a/common/xutil.c b/common/xutil.c index 77b4e8340..96f36345c 100644 --- a/common/xutil.c +++ b/common/xutil.c @@ -497,7 +497,7 @@ xutil_cursor_new(xcb_connection_t *conn, unsigned int cursor_font) /* Get the font for the cursor*/ font = xcb_generate_id(conn); - xcb_open_font(conn, font, sizeof("cursor"), "cursor"); + xcb_open_font(conn, font, sizeof("cursor")-1, "cursor"); cursor = xcb_generate_id(conn); xcb_create_glyph_cursor(conn, cursor, font, font, diff --git a/lua.c b/lua.c index 2907db16a..0b21e940e 100644 --- a/lua.c +++ b/lua.c @@ -537,14 +537,14 @@ luaA_parserc(const char *confpatharg) if(a_strlen(confdir)) { - len = a_strlen(confdir) + sizeof(AWESOME_CONFIG_FILE) + 1; + len = a_strlen(confdir) + sizeof(AWESOME_CONFIG_FILE); confpath = p_new(char, len); a_strcpy(confpath, len, confdir); } else { confdir = getenv("HOME"); - len = a_strlen(confdir) + sizeof(AWESOME_CONFIG_FILE) + sizeof(XDG_CONFIG_HOME_DEFAULT) + 1; + len = a_strlen(confdir) + sizeof(AWESOME_CONFIG_FILE)-1 + sizeof(XDG_CONFIG_HOME_DEFAULT); confpath = p_new(char, len); a_strcpy(confpath, len, confdir); a_strcat(confpath, len, XDG_CONFIG_HOME_DEFAULT); @@ -561,7 +561,7 @@ luaA_parserc(const char *confpatharg) if(!(len = a_strlen(xdg_config_dirs))) { xdg_config_dirs = SYSCONFDIR; - len = sizeof(SYSCONFDIR); + len = sizeof(SYSCONFDIR)-1; } xdg_files = a_strsplit(xdg_config_dirs, len, ':'); @@ -569,7 +569,7 @@ luaA_parserc(const char *confpatharg) for(buf = xdg_files; *buf; buf++) { p_delete(&confpath); - len = a_strlen(*buf) + sizeof("AWESOME_CONFIG_FILE") + 1; + len = a_strlen(*buf) + sizeof("AWESOME_CONFIG_FILE"); confpath = p_new(char, len); a_strcpy(confpath, len, *buf); a_strcat(confpath, len, AWESOME_CONFIG_FILE); @@ -587,7 +587,7 @@ luaA_parserc(const char *confpatharg) /* Assure there's at least one tag */ for(screen = 0; screen < globalconf.screens_info->nscreen; screen++) if(!globalconf.screens[screen].tags.len) - tag_append_to_screen(tag_new("default", sizeof("default"), layout_tile, 0.5, 1, 0), screen); + tag_append_to_screen(tag_new("default", sizeof("default")-1, layout_tile, 0.5, 1, 0), screen); p_delete(&confpath); } diff --git a/mouse.c b/mouse.c index 9da99bacf..3e4a2d8e1 100644 --- a/mouse.c +++ b/mouse.c @@ -276,7 +276,7 @@ mouse_infobox_new(int phys_screen, int border, area_t geometry, globalconf.default_screen, globalconf.font, MOUSE_INFOBOX_STRING_DEFAULT, - sizeof(MOUSE_INFOBOX_STRING_DEFAULT), + sizeof(MOUSE_INFOBOX_STRING_DEFAULT)-1, &pdata); geom.x = geometry.x + ((2 * border + geometry.width) - geom.width) / 2; geom.y = geometry.y + ((2 * border + geometry.height) - geom.height) / 2;