Sergejs Melderis created PROTON-835:
---------------------------------------
Summary: 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
Priority: Critical
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)