OSDN Git Service

monitor: Fix checking for sufficient data
authorJohan Hedberg <johan.hedberg@intel.com>
Wed, 27 Apr 2016 08:25:36 +0000 (11:25 +0300)
committerJohan Hedberg <johan.hedberg@intel.com>
Wed, 27 Apr 2016 11:09:16 +0000 (14:09 +0300)
monitor/control.c

index 508b068..710b975 100644 (file)
@@ -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);