summaryrefslogtreecommitdiff
path: root/surf.c
diff options
context:
space:
mode:
authorQuentin Rameau <quinq@fifth.space>2024-03-17 08:06:01 +0100
committerRafael Marçalo <raroma09@gmail.com>2024-06-10 21:13:36 +0100
commit4f9bfddabcece70d3e2e028b1658715dd20a9274 (patch)
tree617934c26fdaef4f5d2a2af5f953a8f521120192 /surf.c
parentdd27aea9f41bedebd8a593816a3755011dbb3642 (diff)
Fix message sizes for web extension communication
Diffstat (limited to 'surf.c')
-rw-r--r--surf.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/surf.c b/surf.c
index b5fd3a1..61554c5 100644
--- a/surf.c
+++ b/surf.c
@@ -1886,21 +1886,22 @@ zoom(Client *c, const Arg *a)
static void
msgext(Client *c, char type, const Arg *a)
{
- static char msg[MSGBUFSZ];
+ static unsigned char msg[MSGBUFSZ];
int ret;
if (spair[0] < 0)
return;
- if ((ret = snprintf(msg, sizeof(msg), "%c%c%c", c->pageid, type, a->i))
- >= sizeof(msg)) {
+ ret = snprintf(msg, sizeof(msg), "%c%c%c",
+ (unsigned char)c->pageid, type, (signed char)a->i);
+ if (ret >= sizeof(msg)) {
fprintf(stderr, "surf: message too long: %d\n", ret);
return;
}
if (send(spair[0], msg, ret, 0) != ret)
- fprintf(stderr, "surf: error sending: %u%c%d (%d)\n",
- c->pageid, type, a->i, ret);
+ fprintf(stderr, "surf: error sending: %hhu/%c/%d (%d)\n",
+ (unsigned char)c->pageid, type, a->i, ret);
}
void