diff options
| author | Ben Jargowsky <benjar63@gmail.com> | 2022-06-28 20:14:23 +0200 | 
|---|---|---|
| committer | Ben Jargowsky <benjar63@gmail.com> | 2022-06-29 00:35:06 +0200 | 
| commit | 7cc6c640e2412935bf195ec55dafeb5852c71dd1 (patch) | |
| tree | 5c58d8d90d89dd0eabf5d8fd4d36e7df56a777b6 /dwl.c | |
| parent | 72e0a560d9836c5e8658003f548203bcd722e565 (diff) | |
Checks for overflows for client max width and height
Diffstat (limited to 'dwl.c')
| -rw-r--r-- | dwl.c | 5 | 
1 files changed, 3 insertions, 2 deletions
| @@ -4,6 +4,7 @@  #define _POSIX_C_SOURCE 200809L  #include <getopt.h>  #include <libinput.h> +#include <limits.h>  #include <linux/input-event-codes.h>  #include <signal.h>  #include <stdio.h> @@ -386,9 +387,9 @@ applybounds(Client *c, struct wlr_box *bbox)  	/* try to set size hints */  	c->geom.width = MAX(min.width + (2 * c->bw), c->geom.width);  	c->geom.height = MAX(min.height + (2 * c->bw), c->geom.height); -	if (max.width > 0) +	if (max.width > 0 && !(2 * c->bw > INT_MAX - max.width)) // Checks for overflow  		c->geom.width = MIN(max.width + (2 * c->bw), c->geom.width); -	if (max.height > 0) +	if (max.height > 0 && !(2 * c->bw > INT_MAX - max.height)) // Checks for overflow  		c->geom.height = MIN(max.height + (2 * c->bw), c->geom.height);  	if (c->geom.x >= bbox->x + bbox->width) | 
