From e2b6a85e8042f21d3cca92c35ed315fc6ee3a6ce Mon Sep 17 00:00:00 2001 From: Tamas TEVESZ Date: Wed, 24 Dec 2008 14:10:33 +0100 Subject: [PATCH] Fix buffer overflow in SendHelperMessage() The following fixes a buffer overflow in SendHelperMessage() which i started seeing recently on x64. --- src/misc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/misc.c b/src/misc.c index 31cb35af..72f32fd1 100644 --- a/src/misc.c +++ b/src/misc.c @@ -1139,7 +1139,7 @@ SendHelperMessage(WScreen *scr, char type, int workspace, char *msg) len = (msg ? strlen(msg) : 0) + (workspace >=0 ? 4 : 0) + 1 ; buffer = wmalloc(len+5); - snprintf(buf, len, "%4i", len); + snprintf(buf, sizeof(buf), "%4i", len); memcpy(buffer, buf, 4); buffer[4] = type; i = 5;