commit bc55b0fd0ffc494e8efe381e8e603d5c5f5435b1
parent 422708aa45e044827a9f477296bedb04ba4d1b8d
Author: Janne Veteläinen <janne.vetelainen@elisanet.fi>
Date: Thu, 11 Jul 2024 15:55:25 +0300
snprintf -> sprintf
This can't overflow
Diffstat:
4 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/systray/sndbusmenu.c b/systray/sndbusmenu.c
@@ -108,7 +108,7 @@ create_action(uint32_t id, gboolean ischeckmark, SnDbusmenu *self)
{
GSimpleAction *action;
char name[ACTION_NAME_MAX_LEN];
- snprintf(name, sizeof(name), "%u", id);
+ sprintf(name, "%u", id);
if (ischeckmark)
action = g_simple_action_new_stateful(name, NULL, g_variant_new("b", TRUE));
@@ -176,7 +176,7 @@ create_menuitem(int32_t id, GVariant *menuitem_data, GVariant *submenuitem_data,
return NULL;
GSimpleAction *action = create_action(id, ischeckmark, self);
- snprintf(detailed_name, sizeof(detailed_name), "%s.%u", actiongroup_pfx, id);
+ sprintf(detailed_name, "%s.%u", actiongroup_pfx, id);
GMenuItem *menuitem = g_menu_item_new(label, detailed_name);
diff --git a/systray/snhost.c b/systray/snhost.c
@@ -92,7 +92,7 @@ dwlb_request_resize(SnHost *self)
"%s/dwlb/dwlb-0",
g_get_user_runtime_dir());
- char sockbuf[64];
+ char sockbuf[64] = {0};
snprintf(sockbuf, sizeof(sockbuf), "%s %s %i", self->mon, "resize", self->curwidth);
size_t len = strlen(sockbuf);
int sock_fd = socket(AF_UNIX, SOCK_STREAM, 1);
diff --git a/systray/snitem.h b/systray/snitem.h
@@ -2,6 +2,7 @@
#define SNITEM_H
#include <glib-object.h>
+#include <gio/gio.h>
#include <gtk/gtk.h>
G_BEGIN_DECLS
diff --git a/systray/snwatcher.h b/systray/snwatcher.h
@@ -2,7 +2,6 @@
#define SNWATCHER_H
#include <glib-object.h>
-#include <gtk/gtk.h>
G_BEGIN_DECLS