Skip to contentSkip to conversation

tool/hcidump: Fix memory leak with malformed packet

PATCH New Cho, Yu-Chen 1 participant 1 message Mar 16, 2018 Bluetooth drivers

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 tool/hcidump: Fix memory leak with malformed packet

The Supported Commands is a 64 octet bit field.
Do not allow to read more then the size.

---
 tools/parser/csr.c | 5 +++++
 1 file changed, 5 insertions(+)
tools/parser/csr.c +5 -0
index a0a4eb5fe..d14830821 100644
@@ -145,6 +145,11 @@ static inline void commands_dump(int level, char *str, struct frame *frm)
 	unsigned char commands[64];
 	unsigned int i;
 
+	if (frm->len > 64) {
+		perror("Read Error");
+		exit(0);
+	}
+
 	memcpy(commands, frm->ptr, frm->len);
 
 	p_indent(level, frm);
Signature · 1 line
2.16.2