diff mbox series

[BlueZ,v1] avrcp: fix byte order of PDU parameter length compare

Message ID 20210608103940.BlueZ.v1.1.Ifed45e2dfac25b2627fcaabc66cd29f6894ba07b@changeid
State New
Headers show
Series [BlueZ,v1] avrcp: fix byte order of PDU parameter length compare | expand

Commit Message

Michael Sun June 8, 2021, 5:39 p.m. UTC
Fix the issue that directly uses params_len, from received PDU data,
for arithmetic calculation and comparison.

Reviewed-by: Alain Michaud <alainm@chromium.org>
Signed-off-by: Michael Sun <michaelfsun@google.com>
---

 profiles/audio/avrcp.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
diff mbox series

Patch

diff --git a/profiles/audio/avrcp.c b/profiles/audio/avrcp.c
index ccf34b220..2265f87ab 100644
--- a/profiles/audio/avrcp.c
+++ b/profiles/audio/avrcp.c
@@ -1923,9 +1923,9 @@  static size_t handle_vendordep_pdu(struct avctp *conn, uint8_t transaction,
 	operands += sizeof(*pdu);
 	operand_count -= sizeof(*pdu);
 
-	if (pdu->params_len != operand_count) {
+	if (pdu->params_len != htons(operand_count)) {
 		DBG("AVRCP PDU parameters length don't match");
-		pdu->params_len = operand_count;
+		pdu->params_len = htons(operand_count);
 	}
 
 	for (handler = session->control_handlers; handler->pdu_id; handler++) {