qpid-proton mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Alan Conway (JIRA)" <j...@apache.org>
Subject [jira] [Resolved] (PROTON-835) strncmp in pn_data_lookup doesn't work in some cases
Date Fri, 06 Mar 2015 16:50:39 GMT

     [ https://issues.apache.org/jira/browse/PROTON-835?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]

Alan Conway resolved PROTON-835.
--------------------------------
       Resolution: Fixed
    Fix Version/s: 0.9
         Assignee: Alan Conway

> strncmp in pn_data_lookup doesn't work in some cases
> ----------------------------------------------------
>
>                 Key: PROTON-835
>                 URL: https://issues.apache.org/jira/browse/PROTON-835
>             Project: Qpid Proton
>          Issue Type: Bug
>          Components: proton-c
>    Affects Versions: 0.8
>            Reporter: Sergejs Melderis
>            Assignee: Alan Conway
>            Priority: Critical
>             Fix For: 0.9
>
>
> 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);
> }
>      



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Mime
View raw message