~ubuntu-branches/ubuntu/precise/cups/precise-security

« back to all changes in this revision

Viewing changes to .pc/no-conffile-timestamp.patch/scheduler/printers.c

  • Committer: Package Import Robot
  • Author(s): Marc Deslauriers
  • Date: 2012-12-03 09:05:49 UTC
  • mfrom: (97.1.4 precise-proposed)
  • Revision ID: package-import@ubuntu.com-20121203090549-z6f07kt2atlpxjpa
Tags: 1.5.3-0ubuntu5.1
* SECURITY UPDATE: privilege escalation via config file editing
  - debian/patches/CVE-2012-5519.patch: split configuration file into
    two, to isolate options that have a security impact.
  - debian/cups.install: also install cups-files.conf
  - debian/patches/removecvstag.patch: updated to remove tag from
    cups-files.conf.
  - CVE-2012-5519
* debian/control: remove libtiff5-dev alternate build-depends so this
  package can build in a schroot.
* NOTE: this package does _not_ include the changes from 1.5.3-0ubuntu5
  in precise-proposed.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
/*
2
 
 * "$Id: printers.c 10001 2011-09-14 22:38:58Z mike $"
 
2
 * "$Id: printers.c 10295 2012-02-15 23:21:06Z mike $"
3
3
 *
4
4
 *   Printer routines for the CUPS scheduler.
5
5
 *
6
 
 *   Copyright 2007-2011 by Apple Inc.
 
6
 *   Copyright 2007-2012 by Apple Inc.
7
7
 *   Copyright 1997-2007 by Easy Software Products, all rights reserved.
8
8
 *
9
9
 *   These coded instructions, statements, and computer programs are the
2043
2043
  ipp_attribute_t       *attr;          /* Attribute */
2044
2044
  int                   i,              /* Looping var */
2045
2045
                        count;          /* Number of values */
2046
 
  char                  *ptr;           /* Pointer into value */
 
2046
  char                  *ptr,           /* Pointer into value */
 
2047
                        *start,         /* Start of value */
 
2048
                        quote;          /* Quote character */
2047
2049
  ipp_tag_t             value_tag;      /* Value tag for this attribute */
2048
2050
 
2049
2051
 
2061
2063
  * Count the number of values...
2062
2064
  */
2063
2065
 
2064
 
  for (count = 1, ptr = value;
2065
 
       (ptr = strchr(ptr, ',')) != NULL;
2066
 
       ptr ++, count ++);
 
2066
  for (count = 1, quote = '\0', ptr = value;
 
2067
       *ptr;
 
2068
       ptr ++)
 
2069
  {
 
2070
    if (*ptr == quote)
 
2071
      quote = '\0';
 
2072
    else if (quote)
 
2073
      continue;
 
2074
    else if (*ptr == '\\' && ptr[1])
 
2075
      ptr ++;
 
2076
    else if (*ptr == '\'' || *ptr == '\"')
 
2077
      quote = *ptr;
 
2078
    else if (*ptr == ',')
 
2079
      count ++;
 
2080
  }
2067
2081
 
2068
2082
 /*
2069
2083
  * Then add or update the attribute as needed...
2147
2161
      return;
2148
2162
    }
2149
2163
 
2150
 
    for (i = 0; i < count; i ++)
 
2164
    for (i = 0, quote = '\0', ptr = value; i < count; i ++)
2151
2165
    {
2152
 
      if ((ptr = strchr(value, ',')) != NULL)
2153
 
        *ptr++ = '\0';
2154
 
 
2155
 
      attr->values[i].string.text = _cupsStrAlloc(value);
2156
 
 
2157
 
      if (ptr)
2158
 
        value = ptr;
 
2166
      for (start = ptr; *ptr; ptr ++)
 
2167
      {
 
2168
        if (*ptr == quote)
 
2169
          *ptr = quote = '\0';
 
2170
        else if (quote)
 
2171
          continue;
 
2172
        else if (*ptr == '\\' && ptr[1])
 
2173
          _cups_strcpy(ptr, ptr + 1);
 
2174
        else if (*ptr == '\'' || *ptr == '\"')
 
2175
        {
 
2176
          quote = *ptr;
 
2177
 
 
2178
          if (ptr == start)
 
2179
            start ++;
 
2180
          else
 
2181
            _cups_strcpy(ptr, ptr + 1);
 
2182
        }
 
2183
        else if (*ptr == ',')
 
2184
        {
 
2185
          *ptr++ = '\0';
 
2186
          break;
 
2187
        }
 
2188
      }
 
2189
 
 
2190
      attr->values[i].string.text = _cupsStrAlloc(start);
2159
2191
    }
2160
2192
  }
2161
2193
}
5565
5597
 
5566
5598
 
5567
5599
/*
5568
 
 * End of "$Id: printers.c 10001 2011-09-14 22:38:58Z mike $".
 
5600
 * End of "$Id: printers.c 10295 2012-02-15 23:21:06Z mike $".
5569
5601
 */