Skip to contentSkip to conversation

audio/avrcp: Don't overflow uint32_t

PATCH Superseded Marek Kasik 1 participant 1 message Apr 26, 2016 Bluetooth drivers

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 audio/avrcp: Don't overflow uint32_t

Don't overflow uint32_t when checking whether maximal number of items was already processed.
This happens when avrcp_handle_media_player_list() is called with start_item = 0x0 and end_item = UINT32_MAX which is caused by calling of avrcp_get_media_player_list().

---
 profiles/audio/avrcp.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
profiles/audio/avrcp.c +1 -1
index 70c184b..bfd6238 100644
@@ -1895,7 +1895,7 @@ static void avrcp_handle_media_player_list(struct avrcp *session,
 		struct player_item *item;
 		uint16_t namelen;
 
-		if (rsp->num_items == (end_item - start_item) + 1)
+		if (rsp->num_items == ((int64_t) end_item - start_item) + 1)
 			break;
 
 		folder = (void *)&pdu->params[pdu->param_len];
Signature · 1 line
2.7.4