[PATCH 08/12] AVRCP: Return error for invalid metadata IDs

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



---
 audio/avrcp.c |    6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/audio/avrcp.c b/audio/avrcp.c
index a7987fb..0ca91a5 100644
--- a/audio/avrcp.c
+++ b/audio/avrcp.c
@@ -427,6 +427,10 @@ static int player_get_media_attribute(struct avrcp_player *player,
 
 	DBG("Get media attribute: %u", id);
 
+	if (id == AVRCP_MEDIA_ATTRIBUTE_ILLEGAL ||
+			id > AVRCP_MEDIA_ATTRIBUTE_LAST)
+		return -ENOENT;
+
 	value = player->cb->get_metadata(id, player->user_data);
 	if (value == NULL) {
 		len = 0;
@@ -452,8 +456,6 @@ static int player_get_media_attribute(struct avrcp_player *player,
 			return -ENOBUFS;
 		memcpy(elem->val, valstr, len);
 		break;
-	default:
-		return -ENOENT;
 	}
 
 done:
-- 
1.7.7

--
To unsubscribe from this list: send the line "unsubscribe linux-bluetooth" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Bluez Devel]     [Linux Wireless Networking]     [Linux Wireless Personal Area Networking]     [Linux ATH6KL]     [Linux USB Devel]     [Linux Media Drivers]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Big List of Linux Books]

  Powered by Linux