From e2db62ab06e9a31d22121bb7765b7823dc3492b5 Mon Sep 17 00:00:00 2001 From: Luiz Augusto von Dentz Date: Mon, 13 Oct 2014 11:20:39 +0300 Subject: [PATCH] android/avrcp-lib: Add checks for unknown events Unknown events should be treated as protocol error since there is no way to parse them properly and there is no support for vendor specific either. --- android/avrcp-lib.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/android/avrcp-lib.c b/android/avrcp-lib.c index 60d6e97dd..a490d76bb 100644 --- a/android/avrcp-lib.c +++ b/android/avrcp-lib.c @@ -1779,6 +1779,11 @@ static gboolean register_notification_rsp(struct avctp *conn, rsp = (void *) pdu->params; event = rsp->event; + if (event > AVRCP_EVENT_LAST) { + err = -EPROTO; + goto done; + } + switch (event) { case AVRCP_EVENT_STATUS_CHANGED: case AVRCP_EVENT_VOLUME_CHANGED: @@ -1843,6 +1848,9 @@ int avrcp_register_notification(struct avrcp *session, uint8_t event, struct iovec iov; struct register_notification_req req; + if (event > AVRCP_EVENT_LAST) + return -EINVAL; + req.event = event; put_be32(interval, &req.interval); -- 2.47.3