Fixed potential buffer overflow in updatestatus

pull/47/head
Ashish Kumar Yadav 3 years ago
parent 0068619a3c
commit dbace38b2a

@ -4,9 +4,6 @@
/* buffer size for capturing output of the programs used for updating blocks */
#define CMDOUTLENGTH 50
/* buffer size for status text */
#define STATUSLENGTH 256
/* DELIMITERENDCHAR must be less than 32.
* At max, DELIMITERENDCHAR - 1 number of clickable blocks are allowed.
* Raw characters larger than DELIMITERENDCHAR and smaller than ' ' in ASCII

@ -13,6 +13,7 @@
#define LOCKFILE "/tmp/dwmblocks.pid"
#define DELIMITERLENGTH sizeof delimiter
#define STATUSLENGTH ((sizeof blocks / sizeof blocks[0]) * (CMDOUTLENGTH + DELIMITERLENGTH))
#include "config.h"
@ -239,7 +240,7 @@ updateblock(Block *block, int sigval)
void
updatestatus()
{
static char statustext[STATUSLENGTH + DELIMITERLENGTH];
static char statustext[STATUSLENGTH];
char *s = statustext;
Block *block;

Loading…
Cancel
Save