Re: [PATCH] AVDTP Qualification: Fix error handling for AVDTP set configuration command

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

 



On 3/25/09, Marcel Holtmann <marcel@xxxxxxxxxxxx> wrote:
> Hi Nick,
>
>  > +
>  > +               if ((cap->category == AVDTP_MEDIA_TRANSPORT) &&
>  > (cap->length != 0)) {
>  > +                       err = AVDTP_BAD_MEDIA_TRANSPORT_FORMAT;
>  > +                       goto failed;
>
>  no need to put brackets around cap->cat == ... check etc. The comparison
>  takes precedence over &&. Please fix and re-send the patch.

fixed
From f0d527062359212c3506bf2090829406cfd15f0e Mon Sep 17 00:00:00 2001
From: Nick Pelly <npelly@xxxxxxxxxx>
Date: Thu, 26 Mar 2009 16:23:25 -0700
Subject: [PATCH] AVDTP Qualification: Fix error handling for AVDTP set configuration command.

---
 audio/avdtp.c |   11 +++++++++++
 1 files changed, 11 insertions(+), 0 deletions(-)

diff --git a/audio/avdtp.c b/audio/avdtp.c
index 297b578..7764369 100644
--- a/audio/avdtp.c
+++ b/audio/avdtp.c
@@ -1200,6 +1200,7 @@ static gboolean avdtp_setconf_cmd(struct avdtp *session, uint8_t transaction,
 	uint8_t err, category = 0x00;
 	struct audio_device *dev;
 	bdaddr_t src, dst;
+	GSList *l;
 
 	if (size < sizeof(struct setconf_req)) {
 		error("Too short getcap request");
@@ -1247,6 +1248,16 @@ static gboolean avdtp_setconf_cmd(struct avdtp *session, uint8_t transaction,
 					size - sizeof(struct setconf_req),
 					&stream->codec);
 
+	/* Verify that the Media Transport capability's length = 0. Reject otherwise */
+	for (l = stream->caps; l != NULL; l = g_slist_next(l)) {
+		struct avdtp_service_capability *cap = l->data;
+
+		if (cap->category == AVDTP_MEDIA_TRANSPORT && cap->length != 0) {
+			err = AVDTP_BAD_MEDIA_TRANSPORT_FORMAT;
+			goto failed;
+		}
+	}
+
 	if (sep->ind && sep->ind->set_configuration) {
 		if (!sep->ind->set_configuration(session, sep, stream,
 							stream->caps, &err,
-- 
1.5.5


[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