sway

i3-compatible Wayland compositor
git clone https://git.awy.one/sway
Log | Files | Refs | README | LICENSE

commit ac7892371ce1ef7a05619492f0896f525b4dbdc3
parent 9a6687ee04db948a9f61cf2f4cc5966be84c822c
Author: Muhamed Hobi <woohoomoo2u@gmail.com>
Date:   Mon,  7 Feb 2022 19:03:54 -0500

Fix snprintf compiler warning

Diffstat:
Msway/commands/output/background.c | 2+-
Msway/server.c | 2+-
2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/sway/commands/output/background.c b/sway/commands/output/background.c @@ -112,7 +112,7 @@ struct cmd_results *output_cmd_background(int argc, char **argv) { "Unable to allocate resources"); } - sprintf(src, "%s/%s", conf_path, rel_path); + snprintf(src, strlen(conf_path) + strlen(src) + 2, "%s/%s", conf_path, rel_path); free(rel_path); free(conf); } diff --git a/sway/server.c b/sway/server.c @@ -214,7 +214,7 @@ bool server_init(struct sway_server *server) { // Avoid using "wayland-0" as display socket char name_candidate[16]; for (int i = 1; i <= 32; ++i) { - sprintf(name_candidate, "wayland-%d", i); + snprintf(name_candidate, sizeof(name_candidate), "wayland-%d", i); if (wl_display_add_socket(server->wl_display, name_candidate) >= 0) { server->socket = strdup(name_candidate); break;