summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorbakkeby <[email protected]>2020-05-31 15:14:07 +0200
committerbakkeby <[email protected]>2020-05-31 15:14:07 +0200
commite7ea06a0c201522e5012ad4823e6f4d020303c2a (patch)
tree75c8884e577be8b7ab3bdbf1a1167b3e4ff48705
parent7b2c30b371f928fba4f6d0680b6b3396c2b5322c (diff)
downloaddwm-flexipatch-e7ea06a0c201522e5012ad4823e6f4d020303c2a.tar.gz
dwm-flexipatch-e7ea06a0c201522e5012ad4823e6f4d020303c2a.zip
status2d: Minor protection against crashes due to invalid x and y values
-rw-r--r--patch/status2d.c7
1 files changed, 6 insertions, 1 deletions
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
+}