Diff between af4519a50cb8fc0be3398089aa3a85904453de1d and b903344d92e57dba63654e347d200d27f4566837

Changed Files

File Additions Deletions Status
compat/bnep.c +16 -0 modified

Full Patch

diff --git a/compat/bnep.c b/compat/bnep.c
index 24bf7e3..281350b 100644
--- a/compat/bnep.c
+++ b/compat/bnep.c
@@ -231,6 +231,22 @@ int bnep_accept_connection(int sk, uint16_t role, char *dev)
 		return -1;
 
 	req = (void *) pkt;
+
+	/* Highest known Control command ID
+	 * is BNEP_FILTER_MULT_ADDR_RSP = 0x06 */
+	if (req->type == BNEP_CONTROL &&
+				req->ctrl > BNEP_FILTER_MULT_ADDR_RSP) {
+		uint8_t pkt[3];
+
+		pkt[0] = BNEP_CONTROL;
+		pkt[1] = BNEP_CMD_NOT_UNDERSTOOD;
+		pkt[2] = req->ctrl;
+
+		send(sk, pkt, sizeof(pkt), 0);
+
+		return -1;
+	}
+
 	if (req->type != BNEP_CONTROL || req->ctrl != BNEP_SETUP_CONN_REQ)
 		return -1;