Skip to contentSkip to conversation

Fix for figlet

PATCH New Christoph Egger 1 participant 1 message Sep 14, 2006

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Fix for figlet

Hello!

There's a fix for figlet, which prevents accessing a char[] array with a negative index.

The patch applies to xen/tools/figlet/figlet.c The fix has been taken from the OpenBSD ports tree:
http://www.openbsd.org/cgi-bin/cvsweb/ports/misc/figlet/patches/patch-figlet_c

It works for me.

xen/tools/figlet/figlet.c +3 -2
diff -r 2b8dc69744e3 xen/tools/figlet/figlet.c
@@ -1448,8 +1448,9 @@ inchr c;
       }
     else {
       for (k=0;k<smushamount;k++) {
-        outputline[row][outlinelen-smushamount+k] =
-          smushem(outputline[row][outlinelen-smushamount+k],currchar[row][k]);
+        if (outlinelen-smushamount+k >= 0)
+          outputline[row][outlinelen-smushamount+k] =
+            smushem(outputline[row][outlinelen-smushamount+k],currchar[row][k]);
         }
       strcat(outputline[row],currchar[row]+smushamount);
       }

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel