summaryrefslogtreecommitdiff
path: root/profiles
diff options
context:
space:
mode:
authorLuiz Augusto von Dentz <luiz.von.dentz@intel.com>2013-12-19 15:08:39 +0200
committerLuiz Augusto von Dentz <luiz.von.dentz@intel.com>2013-12-19 15:08:56 +0200
commitf9762f5e538fae3bb4b6de37dacd4cea4ce55f47 (patch)
treeafbd4fbd569174461d5643ad3f25b66dcffef5a4 /profiles
parent94b43b6463f4e59542d94beb6b0098ed500c3ca3 (diff)
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.
Diffstat (limited to 'profiles')
-rw-r--r--profiles/audio/avrcp.c8
1 files 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;