mirror of
https://github.com/gryf/wmaker.git
synced 2025-12-20 04:48:06 +01:00
Fix buffer overflow in SendHelperMessage()
The following fixes a buffer overflow in SendHelperMessage() which i started seeing recently on x64.
This commit is contained in:
committed by
Carlos R. Mafra
parent
38074e7bd5
commit
e2b6a85e80
@@ -1139,7 +1139,7 @@ SendHelperMessage(WScreen *scr, char type, int workspace, char *msg)
|
|||||||
|
|
||||||
len = (msg ? strlen(msg) : 0) + (workspace >=0 ? 4 : 0) + 1 ;
|
len = (msg ? strlen(msg) : 0) + (workspace >=0 ? 4 : 0) + 1 ;
|
||||||
buffer = wmalloc(len+5);
|
buffer = wmalloc(len+5);
|
||||||
snprintf(buf, len, "%4i", len);
|
snprintf(buf, sizeof(buf), "%4i", len);
|
||||||
memcpy(buffer, buf, 4);
|
memcpy(buffer, buf, 4);
|
||||||
buffer[4] = type;
|
buffer[4] = type;
|
||||||
i = 5;
|
i = 5;
|
||||||
|
|||||||
Reference in New Issue
Block a user