OSDN Git Service

AVRCP: Fix crash when registering unsupported notification
authorLuiz Augusto von Dentz <luiz.von.dentz@intel.com>
Mon, 3 Jun 2013 03:55:53 +0000 (10:55 +0700)
committerLuiz Augusto von Dentz <luiz.von.dentz@intel.com>
Tue, 11 Jun 2013 10:00:25 +0000 (13:00 +0300)
Reject command if notification is not supported otherwise this can
cause crashes.

profiles/audio/avrcp.c

index 4558407..89ba58c 100644 (file)
@@ -1358,6 +1358,10 @@ static uint8_t avrcp_handle_register_notification(struct avrcp *session,
        if (len != 5)
                goto err;
 
+       /* Check if event is supported otherwise reject */
+       if (!(session->supported_events & (1 << pdu->params[0])))
+               goto err;
+
        switch (pdu->params[0]) {
        case AVRCP_EVENT_STATUS_CHANGED:
                len = 2;