From ca1f08e4aadf7af8c1b7aea71861664ef63dccf2 Mon Sep 17 00:00:00 2001 From: Patrick LeBlanc Date: Tue, 5 Feb 2019 12:56:42 -0600 Subject: [PATCH] Fixed a mem alloc bug in readtask --- src/ReadTask.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/ReadTask.cpp b/src/ReadTask.cpp index 3abac9aae..848c97ef7 100644 --- a/src/ReadTask.cpp +++ b/src/ReadTask.cpp @@ -23,7 +23,7 @@ ReadTask::~ReadTask() return ret; \ } -#define min(x, y) (x < y ? x : y) +#define max(x, y) (x > y ? x : y) bool ReadTask::run() { @@ -42,7 +42,7 @@ bool ReadTask::run() // read from IOC, write to the socket vector outbuf; - outbuf.resize(min(cmd->count, 4) + sizeof(sm_msg_resp)); + outbuf.resize(max(cmd->count, 4) + sizeof(sm_msg_resp)); sm_msg_resp *resp = (sm_msg_resp *) &outbuf[0]; resp->type = SM_MSG_START;