Skip to contentSkip to conversation

Fix crash when there is no enough space to fragment avdtp packet

PATCH In review Luiz Augusto von Dentz 2 participants 2 messages Aug 19, 2010 Bluetooth drivers

lore
Share & tools
lore

Luiz Augusto von Dentz

author maintainer
#0 lore raw

PATCH 1/1 Fix crash when there is no enough space to fragment avdtp packet

From: Luiz Augusto von Dentz <[email protected]>

This was catch when running codenomicon tests when the output mtu is not big enough to stuff fragmented packets.

---
 audio/avdtp.c |    6 ++++++
 1 files changed, 6 insertions(+), 0 deletions(-)
audio/avdtp.c +6 -0
index cf07f6c..cc7066f 100644
@@ -537,6 +537,12 @@ static gboolean avdtp_send(struct avdtp *session, uint8_t transaction,
 		return try_send(sock, session->buf, sizeof(single) + len);
 	}
 
+	/* Check if there is enough space to start packet */
+	if (session->omtu < sizeof(start)) {
+		error("No enough space to fragment packet");
+		return FALSE;
+	}
+
 	/* Count the number of needed fragments */
 	cont_fragments = (len - (session->omtu - sizeof(start))) /
 					(session->omtu - sizeof(cont)) + 1;
Signature · 1 line
1.7.0.4
#1 lore raw

Hi Luiz,

Quoted 7 lines · Luiz Augusto von Dentz

From: Luiz Augusto von Dentz <[email protected]>

This was catch when running codenomicon tests when the output mtu is not big enough to stuff fragmented packets.

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

Thanks. The patch has been pushed upstream.

Johan