2013-06-13 11:18:36 +00:00
|
|
|
diff -up cups-1.7b1/scheduler/printers.c.stringpool-setprinterattr cups-1.7b1/scheduler/printers.c
|
|
|
|
--- cups-1.7b1/scheduler/printers.c.stringpool-setprinterattr 2013-06-13 12:18:04.678129506 +0100
|
|
|
|
+++ cups-1.7b1/scheduler/printers.c 2013-06-13 12:18:04.721129670 +0100
|
|
|
|
@@ -1881,6 +1881,7 @@ cupsdSetPrinterAttr(
|
2013-06-13 10:58:55 +00:00
|
|
|
ipp_attribute_t *attr; /* Attribute */
|
|
|
|
int i, /* Looping var */
|
|
|
|
count; /* Number of values */
|
|
|
|
+ char *value_dup; /* Copy of attribute value string */
|
|
|
|
char *ptr, /* Pointer into value */
|
|
|
|
*start, /* Start of value */
|
|
|
|
quote; /* Quote character */
|
2013-06-13 11:18:36 +00:00
|
|
|
@@ -1949,16 +1950,24 @@ cupsdSetPrinterAttr(
|
2013-06-13 10:58:55 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
- for (i = 0; i < count; i ++)
|
|
|
|
+ if ((value_dup = strdup(value)) == NULL)
|
|
|
|
{
|
|
|
|
- if ((ptr = strchr(value, ',')) != NULL)
|
|
|
|
+ cupsdLogMessage(CUPSD_LOG_ERROR, "Unable to copy attribute value.");
|
|
|
|
+ return;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ for (i = 0, start = value_dup; i < count; i ++)
|
|
|
|
+ {
|
|
|
|
+ if ((ptr = strchr(start, ',')) != NULL)
|
|
|
|
*ptr++ = '\0';
|
|
|
|
|
|
|
|
- attr->values[i].integer = strtol(value, NULL, 10);
|
|
|
|
+ attr->values[i].integer = strtol(start, NULL, 10);
|
|
|
|
|
|
|
|
if (ptr)
|
|
|
|
- value = ptr;
|
|
|
|
+ start = ptr;
|
|
|
|
}
|
|
|
|
+
|
|
|
|
+ free(value_dup);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2013-06-13 11:18:36 +00:00
|
|
|
@@ -1999,7 +2008,13 @@ cupsdSetPrinterAttr(
|
2013-06-13 10:58:55 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
- for (i = 0, quote = '\0', ptr = value; i < count; i ++)
|
|
|
|
+ if ((value_dup = strdup(value)) == NULL)
|
|
|
|
+ {
|
|
|
|
+ cupsdLogMessage(CUPSD_LOG_ERROR, "Unable to copy attribute value.");
|
|
|
|
+ return;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ for (i = 0, quote = '\0', ptr = value_dup; i < count; i ++)
|
|
|
|
{
|
|
|
|
for (start = ptr; *ptr; ptr ++)
|
|
|
|
{
|
2013-06-13 11:18:36 +00:00
|
|
|
@@ -2027,6 +2042,8 @@ cupsdSetPrinterAttr(
|
2013-06-13 10:58:55 +00:00
|
|
|
|
|
|
|
attr->values[i].string.text = _cupsStrAlloc(start);
|
|
|
|
}
|
|
|
|
+
|
|
|
|
+ free(value_dup);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|