From 61bad31ced4deb82647b94cae58e0aaeeff27a7e Mon Sep 17 00:00:00 2001 From: Johan Hedberg Date: Wed, 27 Apr 2016 11:25:36 +0300 Subject: [PATCH] monitor: Fix checking for sufficient data --- monitor/control.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/monitor/control.c b/monitor/control.c index 508b06896..710b97595 100644 --- a/monitor/control.c +++ b/monitor/control.c @@ -1062,11 +1062,11 @@ static void client_callback(int fd, uint32_t events, void *user_data) data->offset += len; - if (data->offset > MGMT_HDR_SIZE) { + if (data->offset >= MGMT_HDR_SIZE) { struct mgmt_hdr *hdr = (struct mgmt_hdr *) data->buf; uint16_t pktlen = le16_to_cpu(hdr->len); - if (data->offset > pktlen + MGMT_HDR_SIZE) { + if (data->offset >= pktlen + MGMT_HDR_SIZE) { uint16_t opcode = le16_to_cpu(hdr->opcode); uint16_t index = le16_to_cpu(hdr->index); -- 2.47.3