From f9762f5e538fae3bb4b6de37dacd4cea4ce55f47 Mon Sep 17 00:00:00 2001 From: Luiz Augusto von Dentz Date: Thu, 19 Dec 2013 15:08:39 +0200 Subject: [PATCH] audio/AVRCP: Fix check for values out of range in SetAbsoluteVolume Volume is 7 bits since the 8 bit should be ignored as it is reserved it should never be > 127. Futhermore the value passed to media_transport_update_device_volume should be the stored in volume as it ignores the reserved bits properly. --- profiles/audio/avrcp.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/profiles/audio/avrcp.c b/profiles/audio/avrcp.c index cd027c675..2eb2ad6d8 100644 --- a/profiles/audio/avrcp.c +++ b/profiles/audio/avrcp.c @@ -1582,14 +1582,12 @@ static uint8_t avrcp_handle_set_absolute_volume(struct avrcp *session, if (len != 1) goto err; - volume = pdu->params[0] & 0x7F; - if (volume > 127) - goto err; - if (!player) goto err; - media_transport_update_device_volume(session->dev, pdu->params[0]); + volume = pdu->params[0] & 0x7F; + + media_transport_update_device_volume(session->dev, volume); return AVC_CTYPE_ACCEPTED; -- 2.47.3