~ubuntu-branches/ubuntu/utopic/cups/utopic

« back to all changes in this revision

Viewing changes to debian/patches/fix-stringpool-corruption.patch

  • Committer: Package Import Robot
  • Author(s): Didier Raboud, Till Kamppeter, Steve Langasek, Didier Raboud
  • Date: 2014-01-03 18:42:39 UTC
  • mfrom: (1.3.2)
  • mto: This revision was merged to the branch mainline in revision 142.
  • Revision ID: package-import@ubuntu.com-20140103184239-juzq32ckr7ra49b3
* New 1.7.0 upstream release

[ Till Kamppeter ]
* Refresh most patches with quilt
* Removed usb-backend-do-not-crash-if-usb-disabled-in-bios and
  cupsd-no-crash-on-avahi-threaded-poll-shutdown patches as they got
  applied upstream
* Removed drop-arch-specifics-from-doc patch as it is not needed
  anymore
* Updated drop_unnecessary_dependencies, manpage-hyphen-minus,
  manpage-translations and ppd-poll-with-client-conf patches manually
  to apply to the new CUPS version
* Added error counting exception from
  usb-backend-do-not-crash-if-usb-disabled-in-bios to
  tests-ignore-warnings
* Install the newly added ippfind utility and its manpage in
  cups-client
* Added pwg.h to libcups2-dev package
* Call dh_auto_clean only if the file Makedefs is present, to avoid a
  FTBFS
* Added color management extensions from Joe Simon's GSoC 2013
  project.
* Patch cups-files.conf to activate CUPS daemon syncing of files when
  closing, so that config files (like printers.conf) do not
  mysteriously disappear (LP: #1157972)
* In the AppArmor profile, allow execution of programs in
  /etc/cups/interfaces/, needed to make CUPS working with queues based
  on System V interface scripts, especially PPD-less queues
  auto-generated by cups-browsed from cups-filters 1.0.41 on.
* Silenced AppArmor noise from udev.conf in syslog (LP: #1229766)

[ Steve Langasek ]
* Add cups-filters (>= 1.0.42) as alternative to foomatic-filters
  (which is deprecated) in package relationships

[ Didier Raboud ]
* Remove Roger Leigh from uploaders on his request with thanks for his
  past work!
* Switch avahi LSB Should-Start dependency to be avahi-daemon; also
  bump package relationship to >= 0.6.31-3~ (Closes: #731608)
* Refresh the manpage translation files
* Move the USB backend quirk rules file to cups-server-common
* Add 38 new 1.7.0 libcups2 symbols
* Mark one C++ libcupsppdc1 symbol as optional as it isn't exported in
  1.7.0 anymore
* Import Fedora patches:
  - to avoid sign-extending CRCs in gz decompression
  - to build with full read-only relocations
  - to fix job history logging (upstream patch)
  - to set the internal default for SyncOnClose to Yes, instead of
    only configuring it to Yes
  - to fix a stringpool corruption issue
  - to prevent USB timeouts causing incorrect print output
* Import Fedora patch updates:
  - to dont-use-dbus-from-two-threads patch so it removes a call to
    avahi_threaded_poll_stop()
  - to avoid_stale_lockfile_in_dbus_notifier patch to call _exit when
    handling SIGTERM
* Move manpage-translations patch at the very end of the patch series
  to have it include all our patches

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
Description: Fix stringpool corruption issue
 
2
Bug-RedHat: https://bugzilla.redhat.com/show_bug.cgi?id=974048
 
3
Origin: upstream
 
4
Last-Update: 2013-11-07
 
5
 
 
6
--- a/scheduler/printers.c
 
7
+++ b/scheduler/printers.c
 
8
@@ -1901,12 +1901,13 @@
 
9
 cupsdSetPrinterAttr(
 
10
     cupsd_printer_t *p,                        /* I - Printer */
 
11
     const char      *name,             /* I - Attribute name */
 
12
-    char            *value)            /* I - Attribute value string */
 
13
+    const char      *value)            /* I - Attribute value string */
 
14
 {
 
15
   ipp_attribute_t      *attr;          /* Attribute */
 
16
   int                  i,              /* Looping var */
 
17
                        count;          /* Number of values */
 
18
-  char                 *ptr,           /* Pointer into value */
 
19
+  char                 *temp,          /* Temporary copy of value string */
 
20
+                       *ptr,           /* Pointer into value */
 
21
                        *start,         /* Start of value */
 
22
                        quote;          /* Quote character */
 
23
   ipp_tag_t            value_tag;      /* Value tag for this attribute */
 
24
@@ -1923,10 +1924,21 @@
 
25
   }
 
26
 
 
27
  /*
 
28
+  * Copy the value string so we can do what we want with it...
 
29
+  */
 
30
+
 
31
+  if ((temp = strdup(value)) == NULL)
 
32
+  {
 
33
+    cupsdLogMessage(CUPSD_LOG_ERROR,
 
34
+                    "Unable to duplicate value for \"%s\" attribute.", name);
 
35
+    return;
 
36
+  }
 
37
+
 
38
+ /*
 
39
   * Count the number of values...
 
40
   */
 
41
 
 
42
-  for (count = 1, quote = '\0', ptr = value;
 
43
+  for (count = 1, quote = '\0', ptr = temp;
 
44
        *ptr;
 
45
        ptr ++)
 
46
   {
 
47
@@ -1974,15 +1986,15 @@
 
48
       return;
 
49
     }
 
50
 
 
51
-    for (i = 0; i < count; i ++)
 
52
+    for (i = 0, start = temp; i < count; i ++)
 
53
     {
 
54
-      if ((ptr = strchr(value, ',')) != NULL)
 
55
+      if ((ptr = strchr(start, ',')) != NULL)
 
56
         *ptr++ = '\0';
 
57
 
 
58
-      attr->values[i].integer = strtol(value, NULL, 10);
 
59
+      attr->values[i].integer = strtol(start, NULL, 10);
 
60
 
 
61
       if (ptr)
 
62
-        value = ptr;
 
63
+        start = ptr;
 
64
     }
 
65
   }
 
66
   else
 
67
@@ -2024,7 +2036,7 @@
 
68
       return;
 
69
     }
 
70
 
 
71
-    for (i = 0, quote = '\0', ptr = value; i < count; i ++)
 
72
+    for (i = 0, quote = '\0', ptr = temp; i < count; i ++)
 
73
     {
 
74
       for (start = ptr; *ptr; ptr ++)
 
75
       {
 
76
@@ -2053,6 +2065,8 @@
 
77
       attr->values[i].string.text = _cupsStrAlloc(start);
 
78
     }
 
79
   }
 
80
+
 
81
+  free(temp);
 
82
 }
 
83
 
 
84
 
 
85
--- a/scheduler/printers.h
 
86
+++ b/scheduler/printers.h
 
87
@@ -168,7 +168,8 @@
 
88
                                                 ipp_attribute_t *attr);
 
89
 extern void            cupsdSetDeviceURI(cupsd_printer_t *p, const char *uri);
 
90
 extern void            cupsdSetPrinterAttr(cupsd_printer_t *p,
 
91
-                                           const char *name, char *value);
 
92
+                                           const char *name,
 
93
+                                           const char *value);
 
94
 extern void            cupsdSetPrinterAttrs(cupsd_printer_t *p);
 
95
 extern int             cupsdSetPrinterReasons(cupsd_printer_t *p,
 
96
                                               const char *s);