Fixed potential buffer overflow in updatestatus

This commit is contained in:
Ashish Kumar Yadav 2021-03-28 12:46:03 +05:30
parent 0068619a3c
commit dbace38b2a
2 changed files with 2 additions and 4 deletions

View file

@ -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

View file

@ -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;