[hackers] [dwm] add an additional check in resize() to prevent a crash of dwm

From: Anselm R. Garbe <arg_AT_suckless.org>
Date: Thu Mar 29 15:22:32 2007

changeset: 852:2a57c24a0a85
user: Anselm R. Garbe <arg_AT_suckless.org>
date: Thu Mar 29 15:17:57 2007 +0200
summary: add an additional check in resize() to prevent a crash of dwm

diff -r 2dec35ad6703 -r 2a57c24a0a85 client.c
--- a/client.c Mon Mar 05 11:54:59 2007 +0100
+++ b/client.c Thu Mar 29 15:17:57 2007 +0200
@@ -233,7 +233,7 @@ resize(Client *c, int x, int y, int w, i
         if(w <= 0 || h <= 0)
                 return;
         if(sizehints) {
- if(c->minay > 0 && c->maxay && (h - c->baseh) > 0) {
+ if(c->minay > 0 && c->maxay > 0 && (h - c->baseh) > 0) {
                         dx = (float)(w - c->basew);
                         dy = (float)(h - c->baseh);
                         min = (float)(c->minax) / (float)(c->minay);
@@ -267,6 +267,8 @@ resize(Client *c, int x, int y, int w, i
                 if(c->inch)
                         h -= (h - c->baseh) % c->inch;
         }
+ if(w <= 0 || h <= 0)
+ return;
         if(w == sw && h == sh)
                 c->border = 0;
         else
Received on Thu Mar 29 2007 - 15:22:32 UTC

This archive was generated by hypermail 2.2.0 : Sun Jul 13 2008 - 15:56:29 UTC