From: Luiz Augusto von Dentz <luiz.dentz@gmail.com>
To: linux-bluetooth@vger.kernel.org
Subject: [PATCH BlueZ 3/4] android/avrcp-lib: Add checks for unknown events
Date: Mon, 13 Oct 2014 12:55:49 +0300 [thread overview]
Message-ID: <1413194150-21751-3-git-send-email-luiz.dentz@gmail.com> (raw)
In-Reply-To: <1413194150-21751-1-git-send-email-luiz.dentz@gmail.com>
From: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
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 60d6e97..a490d76 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);
--
1.9.3
next prev parent reply other threads:[~2014-10-13 9:55 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-10-13 9:55 [PATCH BlueZ 1/4] android/avrcp-lib: Add status parameter Luiz Augusto von Dentz
2014-10-13 9:55 ` [PATCH BlueZ 2/4] android/avrcp-lib: Rework callback return Luiz Augusto von Dentz
2014-10-13 9:55 ` Luiz Augusto von Dentz [this message]
2014-10-13 9:55 ` [PATCH BlueZ 4/4] unit/test-avrcp: Add /TP/MCN/NP/BV-07-C test Luiz Augusto von Dentz
2014-10-17 8:14 ` [PATCH BlueZ 1/4] android/avrcp-lib: Add status parameter Luiz Augusto von Dentz
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1413194150-21751-3-git-send-email-luiz.dentz@gmail.com \
--to=luiz.dentz@gmail.com \
--cc=linux-bluetooth@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox