Skip to content

Commit

Permalink
Fix regressions in ippValidateAttribute (Issue #5322, Issue #5330)
Browse files Browse the repository at this point in the history
  • Loading branch information
michaelrsweet committed Jun 11, 2018
1 parent c7dee40 commit 18545a5
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 20 deletions.
4 changes: 3 additions & 1 deletion CHANGES.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
CHANGES - 2.2.9 - 2018-06-05
CHANGES - 2.2.9 - 2018-06-11
============================


Changes in CUPS v2.2.9
----------------------

- Fixed a regression in the changes to ippValidateAttribute (Issue #5322,
Issue #5330)
- Fixed a memory leak for some IPP (extension) syntaxes.


Expand Down
44 changes: 25 additions & 19 deletions cups/ipp.c
Original file line number Diff line number Diff line change
Expand Up @@ -5101,16 +5101,19 @@ ippValidateAttribute(
break;
}

if (*ptr < ' ' || *ptr == 0x7f)
{
ipp_set_error(IPP_STATUS_ERROR_BAD_REQUEST, _("\"%s\": Bad text value \"%s\" - bad control character (PWG 5100.14 section 8.3)."), attr->name, attr->values[i].string.text);
return (0);
}
else if (*ptr)
{
ipp_set_error(IPP_STATUS_ERROR_BAD_REQUEST, _("\"%s\": Bad text value \"%s\" - bad UTF-8 sequence (RFC 8011 section 5.1.2)."), attr->name, attr->values[i].string.text);
return (0);
}
if (*ptr)
{
if (*ptr < ' ' || *ptr == 0x7f)
{
ipp_set_error(IPP_STATUS_ERROR_BAD_REQUEST, _("\"%s\": Bad text value \"%s\" - bad control character (PWG 5100.14 section 8.3)."), attr->name, attr->values[i].string.text);
return (0);
}
else
{
ipp_set_error(IPP_STATUS_ERROR_BAD_REQUEST, _("\"%s\": Bad text value \"%s\" - bad UTF-8 sequence (RFC 8011 section 5.1.2)."), attr->name, attr->values[i].string.text);
return (0);
}
}

if ((ptr - attr->values[i].string.text) > (IPP_MAX_TEXT - 1))
{
Expand Down Expand Up @@ -5163,16 +5166,19 @@ ippValidateAttribute(
break;
}

if (*ptr < ' ' || *ptr == 0x7f)
{
ipp_set_error(IPP_STATUS_ERROR_BAD_REQUEST, _("\"%s\": Bad name value \"%s\" - bad control character (PWG 5100.14 section 8.1)."), attr->name, attr->values[i].string.text);
return (0);
}
else if (*ptr)
if (*ptr)
{
ipp_set_error(IPP_STATUS_ERROR_BAD_REQUEST, _("\"%s\": Bad name value \"%s\" - bad UTF-8 sequence (RFC 8011 section 5.1.3)."), attr->name, attr->values[i].string.text);
return (0);
}
if (*ptr < ' ' || *ptr == 0x7f)
{
ipp_set_error(IPP_STATUS_ERROR_BAD_REQUEST, _("\"%s\": Bad name value \"%s\" - bad control character (PWG 5100.14 section 8.1)."), attr->name, attr->values[i].string.text);
return (0);
}
else
{
ipp_set_error(IPP_STATUS_ERROR_BAD_REQUEST, _("\"%s\": Bad name value \"%s\" - bad UTF-8 sequence (RFC 8011 section 5.1.3)."), attr->name, attr->values[i].string.text);
return (0);
}
}

if ((ptr - attr->values[i].string.text) > (IPP_MAX_NAME - 1))
{
Expand Down

0 comments on commit 18545a5

Please sign in to comment.