diff options
author | Michael R Sweet <michael.r.sweet@gmail.com> | 2018-06-11 09:37:55 -0400 |
---|---|---|
committer | Didier Raboud <odyx@debian.org> | 2018-06-11 19:26:22 +0200 |
commit | 039f30d74597b01c9ba1bbe90a52359ebdbad495 (patch) | |
tree | 53fdd5d779abb56eba350baa043c9c1bc1129eb0 | |
parent | d6f92953b4e8bddafeae068fe5e9005dcf4b30f9 (diff) |
Fix regressions in ippValidateAttribute (Issue #5322, Issue #5330)
-rw-r--r-- | cups/ipp.c | 44 |
1 files changed, 25 insertions, 19 deletions
diff --git a/cups/ipp.c b/cups/ipp.c index b33a3bc2e..57d962058 100644 --- a/cups/ipp.c +++ b/cups/ipp.c @@ -5097,16 +5097,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)) { @@ -5159,16 +5162,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)) { |