Sophie

Sophie

distrib > Scientific%20Linux > 5x > x86_64 > by-pkgid > b2b31f8f12ce25fb0a2128354ea26724 > files > 4

cups-1.3.7-30.el5.src.rpm

diff -up cups-1.3.7/filter/image-sgilib.c.CVE-2008-3639 cups-1.3.7/filter/image-sgilib.c
--- cups-1.3.7/filter/image-sgilib.c.CVE-2008-3639	2008-01-16 22:20:33.000000000 +0000
+++ cups-1.3.7/filter/image-sgilib.c	2008-09-30 12:39:16.000000000 +0100
@@ -640,13 +640,14 @@ read_rle8(FILE           *fp,		/* I - Fi
     if (ch & 128)
     {
       for (i = 0; i < count; i ++, row ++, xsize --, length ++)
-        *row = getc(fp);
+        if (xsize > 0)
+	  *row = getc(fp);
     }
     else
     {
       ch = getc(fp);
       length ++;
-      for (i = 0; i < count; i ++, row ++, xsize --)
+      for (i = 0; i < count && xsize > 0; i ++, row ++, xsize --)
         *row = ch;
     }
   }
@@ -685,14 +686,15 @@ read_rle16(FILE           *fp,		/* I - F
     if (ch & 128)
     {
       for (i = 0; i < count; i ++, row ++, xsize --, length ++)
-        *row = getshort(fp);
+        if (xsize > 0)
+	  *row = getshort(fp);
     }
     else
     {
       ch = getshort(fp);
       length ++;
-      for (i = 0; i < count; i ++, row ++, xsize --)
-        *row = ch;
+      for (i = 0; i < count && xsize > 0; i ++, row ++, xsize --)
+	*row = ch;
     }
   }