Re: [MOD] STR #4262: segmentation fault in test/ipptool.c:2557

Michael Sweet <[email protected]> Mon, 21 Jan 2013 05:00:22 -0800 (PST)
Newsgroups gmane.comp.printing.cups.bugs
Message-ID <[email protected]>
DO NOT REPLY TO THIS MESSAGE.  INSTEAD, POST ANY RESPONSES TO THE LINK BELOW.

[STR Closed w/Resolution]

Ulrich,

RFC 2911 does indeed require that a conforming IPP Server respond with
attributes-charset and attributes-natural-language as the first two
attributes in the response message - see section 3.1.4.  So a printer that
does not provide any attributes in the response is non-conforming, and
there are checks in ipptool for this specifically.

That said, we shouldn't be crashing in this situation. But your suggested
fix is not OK since it will cause the attribute group order tests to fail
- instead the initial value can be IPP_TAG_ZERO if attrptr is NULL. I've
fixed the two spots where this happens.

Link: https://www.cups.org/str.php?L4262
Version: 1.6.1
Fix Version: 1.7-current (r10827)

_______________________________________________
cups-bugs mailing list
[email protected]
http://lists.easysw.com/mailman/listinfo/cups-bugs
str4262.patch (text/plain, 766 B)
Index: test/ipptool.c
===================================================================
--- test/ipptool.c	(revision 10826)
+++ test/ipptool.c	(working copy)
@@ -2278,7 +2278,8 @@
       if (request->attrs)
       {
 	puts("<dict>");
-	for (attrptr = request->attrs, group = attrptr->group_tag;
+	for (attrptr = request->attrs,
+	         group = attrptr ? attrptr->group_tag : IPP_TAG_ZERO;
 	     attrptr;
 	     attrptr = attrptr->next)
 	  print_attr(attrptr, &group);
@@ -2632,7 +2633,8 @@
 
 	a = cupsArrayNew((cups_array_func_t)strcmp, NULL);
 
-	for (attrptr = response->attrs, group = attrptr->group_tag;
+	for (attrptr = response->attrs,
+	         group = attrptr ? attrptr->group_tag : IPP_TAG_ZERO;
 	     attrptr;
 	     attrptr = attrptr->next)
 	{