- status: open --> accepted
- assigned_to: Stefan Bender
In the function trdp_indexedFindSubAddr() in trdp_pdindex.c, first a binary search is performed for an entry with the same comId in the pRcvTableComId which stores all subscribed comId elements in a sorted manner. Because binary search is being used on a table which can have repetitions there might be other better matches possible, hence once a first hit/match is found, a sequential search is then intended to be done for same comId entries after iterating all the way back until the comId is same.
Hence, once a match is found and after traversing all the way back until same comId, a sequential search should be done by iterating over this pRcvTableComId. In this step, there seems to be a problem. After traversing back to the first item, the function trdp_findSubAddr() is re-used for the sequential search. However, trdp_findSubAddr() will perform sequential search by iterating through the linked list (pItem->pNext) in appHandle->pRcvQueue but instead the iteration should be over the pRcvTableComId table. Because the whole context of the search changes, there is a possibility that a better match can indeed go undetected.