From e7ea06a0c201522e5012ad4823e6f4d020303c2a Mon Sep 17 00:00:00 2001 From: bakkeby Date: Sun, 31 May 2020 15:14:07 +0200 Subject: [PATCH] status2d: Minor protection against crashes due to invalid x and y values --- patch/status2d.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/patch/status2d.c b/patch/status2d.c index c2c3d75..261a572 100644 --- a/patch/status2d.c +++ b/patch/status2d.c @@ -108,6 +108,11 @@ drawstatusbar(Monitor *m, int bh, char* stext, int stw, int stp) while (text[++i] != ','); int rh = atoi(text + ++i); + if (ry < 0) + ry = 0; + if (rx < 0) + rx = 0; + drw_rect(drw, rx + x, ry, rw, rh, 1, 0); } else if (text[i] == 'f') { x += atoi(text + ++i); @@ -172,4 +177,4 @@ status2dtextlength(char* stext) else isCode = 0; return w; -} \ No newline at end of file +}