Uploaded image for project: 'Camel'
  1. Camel
  2. CAMEL-7459

parseQuery Drops Char When Last Parameter is RAW with value ending in ')'

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Minor
    • Resolution: Fixed
    • 2.11.0
    • 2.12.4, 2.13.2, 2.14.0
    • camel-core
    • None
    • Novice

    Description

      org.apache.camel.util.URISupport

      When processing RAW parameters as part of parseQuery a look ahead to the next char is needed in order to determine the end of the RAW value. The logic to prevent a StringIndexOutOfBoundsException drops the last char when evaluating for next char when the current char (i) is the second to last char of the string.

      This becomes an issue when the RAW value ends in ')'

      Consider:
      uri = "foo=RAW(ba(r))"
      uri.length() = 14
      i = 12
      uri.charAt(12) = ')'
      uri.charAt(13) = ')'

      (i < uri.legnth() - 2) = 12 < (14 - 2) = 12 < 12 = false
      thus next = "\u0000"

      The RAW value now ends satisfying the requirements and the char at index 13 is never read. The resulting parameter is "foo=RAW(ba(r)".

      The logic to prevent the index exception should be "(i <= uri.legnth() -2)" or "(i < uri.legnth() - 1)"

      Attachments

        Activity

          People

            davsclaus Claus Ibsen
            gillmatthewj Matthew Gill
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: