Uploaded image for project: 'Qpid Proton'
  1. Qpid Proton
  2. PROTON-835

strncmp in pn_data_lookup doesn't work in some cases

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Critical
    • Resolution: Fixed
    • proton-0.8
    • proton-0.9
    • proton-c
    • None

    Description

      pn_data_lookup in codec.c doesn't always work correctly when a message has two properties in which one property is a prefix for another. In my particular use case the properties were 'msc_gt' and 'msc_gt_service'. and the pn_data_lookup was returning a pointer to 'msc_gt' when was called with 'msc_gt_service'.

      I fixed it by comparing the length of pn_bytes_t and the length of the property name as so:
      size_t namelen = strlen(name);
      pn_bytes_t bytes = pn_data_get_bytes(data);
      if (namelen == bytes.size && !strncmp(name, bytes.start, bytes.size)) {
      return pn_data_next(data);
      }

      Attachments

        Activity

          People

            aconway Alan Conway
            sergey.melderis@gmail.com Sergejs Melderis
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: