[cups.bugs] [MOD] STR #3319: hpgltops filter loops if LB command unterminated

jmrm.eng.cam.ac jmrm at eng.cam.ac.uk
Thu Sep 3 09:09:55 PDT 2009


DO NOT REPLY TO THIS MESSAGE.  INSTEAD, POST ANY RESPONSES TO THE LINK BELOW.

[STR New]

The hpgltops filter loops if the string argument to the LB command is
unterminated. The following patch fixes this:

diff -N -U 5 cups-1.3.9.pre/filter/hpgl-input.c
cups-1.3.9/filter/hpgl-input.c
--- cups-1.3.9.pre/filter/hpgl-input.c  2008-07-11 23:48:49.000000000
+0100
+++ cups-1.3.9/filter/hpgl-input.c      2009-09-02 10:08:04.769744000
+0100
@@ -142,14 +142,19 @@
   }
 
   if (!strcasecmp(name, "LB"))
   {
     bufptr = buf;
-    while ((ch = getc(fp)) != StringTerminator)
+    while ((ch = getc(fp)) != StringTerminator && ch != EOF)
       if (bufptr < (buf + sizeof(buf) - 1))
         *bufptr++ = ch;
     *bufptr = '\0';
+    if (ch == EOF) {
+       fputs(_("ERROR: Unterminated HP-GL/2 LB command, unable to print
file!\n
"),
+             stderr);
+       return (-1);
+    }
 
     p[num_params].type         = PARAM_STRING;
     p[num_params].value.string = strdup(buf);
     num_params ++;
   }

Link: http://www.cups.org/str.php?L3319
Version: 1.3.9





More information about the cups-devel mailing list