1
Description: Fix stringpool corruption issue
2
Bug-RedHat: https://bugzilla.redhat.com/show_bug.cgi?id=974048
4
Last-Update: 2013-11-07
6
--- a/scheduler/printers.c
7
+++ b/scheduler/printers.c
8
@@ -1901,12 +1901,13 @@
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 */
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 @@
28
+ * Copy the value string so we can do what we want with it...
31
+ if ((temp = strdup(value)) == NULL)
33
+ cupsdLogMessage(CUPSD_LOG_ERROR,
34
+ "Unable to duplicate value for \"%s\" attribute.", name);
39
* Count the number of values...
42
- for (count = 1, quote = '\0', ptr = value;
43
+ for (count = 1, quote = '\0', ptr = temp;
47
@@ -1974,15 +1986,15 @@
51
- for (i = 0; i < count; i ++)
52
+ for (i = 0, start = temp; i < count; i ++)
54
- if ((ptr = strchr(value, ',')) != NULL)
55
+ if ((ptr = strchr(start, ',')) != NULL)
58
- attr->values[i].integer = strtol(value, NULL, 10);
59
+ attr->values[i].integer = strtol(start, NULL, 10);
71
- for (i = 0, quote = '\0', ptr = value; i < count; i ++)
72
+ for (i = 0, quote = '\0', ptr = temp; i < count; i ++)
74
for (start = ptr; *ptr; ptr ++)
77
attr->values[i].string.text = _cupsStrAlloc(start);
85
--- a/scheduler/printers.h
86
+++ b/scheduler/printers.h
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);
94
extern void cupsdSetPrinterAttrs(cupsd_printer_t *p);
95
extern int cupsdSetPrinterReasons(cupsd_printer_t *p,