Details
-
Bug
-
Status: Closed
-
Critical
-
Resolution: Fixed
-
proton-0.8
-
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);
}