AVDTP Qualification: Fix error handling for AVDTP set configuration command.

This commit is contained in:
Nick Pelly 2009-03-26 16:23:25 -07:00 committed by Marcel Holtmann
parent d75aa0393e
commit 83e5483ee1

View File

@ -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,