Module Name:    xsrc
Committed By:   christos
Date:           Sat Sep  5 14:08:55 UTC 2015

Modified Files:
        xsrc/external/mit/ctwm/dist: util.c

Log Message:
cID 1322887: Fix bogus NULL check and deref.


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 xsrc/external/mit/ctwm/dist/util.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: xsrc/external/mit/ctwm/dist/util.c
diff -u xsrc/external/mit/ctwm/dist/util.c:1.1 xsrc/external/mit/ctwm/dist/util.c:1.2
--- xsrc/external/mit/ctwm/dist/util.c:1.1	Thu Sep  3 18:16:33 2015
+++ xsrc/external/mit/ctwm/dist/util.c	Sat Sep  5 10:08:55 2015
@@ -2879,11 +2879,14 @@ void PaintTitleButton (TwmWindow *tmp_wi
 void PaintTitleButtons (TwmWindow *tmp_win)
 {
     int i;
-    TBWindow *tbw;
+    TBWindow *tbw = tmp_win->titlebuttons;
     int nb = Scr->TBInfo.nleft + Scr->TBInfo.nright;
 
-    for (i = 0, tbw = tmp_win->titlebuttons; i < nb; i++, tbw++) {
-	if (tbw) PaintTitleButton (tmp_win, tbw);
+    if (tbw == NULL)
+	return;
+
+    for (i = 0, i < nb; i++, tbw++) {
+	PaintTitleButton (tmp_win, tbw);
     }
 }
 

Reply via email to