]> git.pld-linux.org Git - packages/cups.git/blob - cups-hpgl-fixes.patch
- added backported CAN-2005-2097 patch, release 25
[packages/cups.git] / cups-hpgl-fixes.patch
1 --- cups-1.1.14/filter/hpgl-input.c.orig        2002-01-02 18:58:57.000000000 +0100
2 +++ cups-1.1.14/filter/hpgl-input.c     2004-12-22 15:37:13.000000000 +0100
3 @@ -3,7 +3,7 @@
4   *
5   *   HP-GL/2 input processing for the Common UNIX Printing System (CUPS).
6   *
7 - *   Copyright 1993-2002 by Easy Software Products.
8 + *   Copyright 1993-2004 by Easy Software Products.
9   *
10   *   These coded instructions, statements, and computer programs are the
11   *   property of Easy Software Products and are protected by Federal
12 @@ -15,9 +15,9 @@
13   *       Attn: CUPS Licensing Information
14   *       Easy Software Products
15   *       44141 Airport View Drive, Suite 204
16 - *       Hollywood, Maryland 20636-3111 USA
17 + *       Hollywood, Maryland 20636 USA
18   *
19 - *       Voice: (301) 373-9603
20 + *       Voice: (301) 373-9600
21   *       EMail: cups-info@cups.org
22   *         WWW: http://www.cups.org
23   *
24 @@ -52,7 +52,8 @@
25                 ch,             /* Current char */
26                 done,           /* Non-zero when the current command is read */
27                 i;              /* Looping var */
28 -  char         buf[262144];    /* String buffer */
29 +  char         buf[262144],    /* String buffer */
30 +               *bufptr;        /* Pointer into buffer */
31    static param_t p[MAX_PARAMS];        /* Parameter buffer */
32  
33  
34 @@ -101,11 +102,24 @@
35              }
36              break;
37  
38 +        case '%' : /* PJL command? */
39 +            if (getc(fp) == '-')
40 +           {
41 +            /*
42 +             * Yes, dump everything up to the "ENTER LANGUAGE" line...
43 +             */
44 +
45 +              while (fgets(buf, sizeof(buf), fp) != NULL)
46 +               if (strstr(buf, "ENTER") && strstr(buf, "LANGUAGE"))
47 +                 break;
48 +             break;
49 +           }
50 +
51          default : /* HP RTL/PCL control */
52 -            while ((i = getc(fp)) != EOF && !isupper(i));
53 +            while ((i = getc(fp)) != EOF && !isupper(i & 255));
54              break;
55        }
56 -  } while (ch == 0x1b);
57 +  } while (ch < ' ');
58  
59    name[0] = ch;
60    name[1] = getc(fp);
61 @@ -113,9 +127,12 @@
62  
63    if (strcasecmp(name, "LB") == 0)
64    {
65 -    for (i = 0; (ch = getc(fp)) != StringTerminator; i ++)
66 -      buf[i] = ch;
67 -    buf[i] = '\0';
68 +    bufptr = buf;
69 +    while ((ch = getc(fp)) != StringTerminator)
70 +      if (bufptr < (buf + sizeof(buf) - 1))
71 +        *bufptr++ = ch;
72 +    *bufptr = '\0';
73 +
74      p[num_params].type         = PARAM_STRING;
75      p[num_params].value.string = strdup(buf);
76      num_params ++;
77 @@ -140,11 +157,12 @@
78    }
79    else if (strcasecmp(name, "PE") == 0)
80    {
81 -    for (i = 0; i < (sizeof(buf) - 1); i ++)
82 -      if ((buf[i] = getc(fp)) == ';')
83 -        break;
84 +    bufptr = buf;
85 +    while ((ch = getc(fp)) != ';')
86 +      if (bufptr < (buf + sizeof(buf) - 1))
87 +        *bufptr++ = ch;
88 +    *bufptr = '\0';
89  
90 -    buf[i] = '\0';
91      p[num_params].type         = PARAM_STRING;
92      p[num_params].value.string = strdup(buf);
93      num_params ++;
This page took 0.079123 seconds and 3 git commands to generate.