[dwm] another little patch :)

From: Premysl Hruby <dfenze_AT_gmail.com>
Date: Tue, 3 Jun 2008 23:13:02 +0200

Hi,

Patch:

===================================================================
diff -r f5140606987d dwm.c
--- a/dwm.c Tue Jun 03 21:07:08 2008 +0200
+++ b/dwm.c Tue Jun 03 23:07:56 2008 +0200
@@ -555,7 +555,7 @@
 void
 drawtext(const char *text, ulong col[ColLast], Bool invert) {
         int i, x, y, h;
- uint len, olen;
+ int len, olen;
         XRectangle r = { dc.x, dc.y, dc.w, dc.h };
         char buf[256];
 
@@ -1583,8 +1583,8 @@
 
 void
 updategeom(void) {
+#ifdef XINERAMA
         int i;
-#ifdef XINERAMA
         XineramaScreenInfo *info = NULL;
 
         /* window area geometry */
==================================================================

In first chunk of patch, it removes very bad case, that if len (of text
drawable) is less than 3 characters, it will cause underrun of text
which is draw via X call:

for(i = len; i >= MAX(0, len - 3); buf[i--] = '.');

because len was unsigned, then if len < 3, len - 3 will be very big
number (because it's unsigned).

Second chunk is only detail, to avoid unused variable in case XINERAMA
is not enabled in compile time.

-Ph

-- 
Premysl "Anydot" Hruby, http://www.redrum.cz/
Received on Tue Jun 03 2008 - 23:13:01 UTC

This archive was generated by hypermail 2.2.0 : Sun Jul 13 2008 - 15:46:53 UTC