diff options
author | Luiz Augusto von Dentz <luiz.von.dentz@intel.com> | 2014-02-03 11:37:29 +0200 |
---|---|---|
committer | Luiz Augusto von Dentz <luiz.von.dentz@intel.com> | 2014-02-05 11:35:59 +0200 |
commit | f61d39bc62b231671a708193ef348a2adcfa29dc (patch) | |
tree | c06374f67cf4155bf547b94ed123d3b47f3c3f78 /profiles | |
parent | f52cd974a3e652f4356667af0ef6fcf0d5d54ee9 (diff) | |
download | bluez-f61d39bc62b231671a708193ef348a2adcfa29dc.tar.gz |
audio/AVRCP: Fix checking for handler pointer instead of pdu_id
The code may not find a valid handler for the pdu_id, in that case the
handler would not be NULL because the handlers table is not NULL
terminated, instead the code should check if pdu_id really matches.
Diffstat (limited to 'profiles')
-rw-r--r-- | profiles/audio/avrcp.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/profiles/audio/avrcp.c b/profiles/audio/avrcp.c index 443b61c26..43ae85ae2 100644 --- a/profiles/audio/avrcp.c +++ b/profiles/audio/avrcp.c @@ -1673,7 +1673,7 @@ static size_t handle_vendordep_pdu(struct avctp *conn, uint8_t transaction, break; } - if (!handler || handler->code != *code) { + if (handler->pdu_id != pdu->pdu_id || handler->code != *code) { pdu->params[0] = AVRCP_STATUS_INVALID_COMMAND; goto err_metadata; } @@ -1734,12 +1734,12 @@ static size_t handle_browsing_pdu(struct avctp *conn, for (handler = browsing_handlers; handler->pdu_id; handler++) { if (handler->pdu_id == pdu->pdu_id) - break; + goto done; } - if (handler == NULL || handler->func == NULL) - return avrcp_browsing_general_reject(operands); + return avrcp_browsing_general_reject(operands); +done: session->transaction = transaction; handler->func(session, pdu, transaction); return AVRCP_BROWSING_HEADER_LENGTH + ntohs(pdu->param_len); |