SDP scanner: get rid of the tail recursion in parseAttributeValue()
The patch 0124934456be1040d5887cbb2720d388e4bfb61b fixed the recursion
issues in the BlueZ implementation of the service discovery. However,
that code only parses the data that it receives from the sdpscanner
tool.
This patch addresses one of the recursion issues in the tool itself.
The parseAttributeValue() function was calling itself with data->next
node until the new node was nullptr. This could lead to infinite
recursion if there is a loop in the input sdp_data_t structure, or
simply exceed the size of the stack for a very long sdp record.
Avoid the tail recursion by rewriting the body of the function to use
while (data) {
// logic here
data = data->next;
}
loop.
Pick to all branches active branches, including esm.
Task-number: QTBUG-145960
Pick-to: 6.11 6.8 6.5 5.15
Change-Id: I69a16b3890e183267aff42d935f8407943c96550
Reviewed-by: Juha Vuolle <juha.vuolle@qt.io>