Commit 9227e26f authored by Alejandro Homs Puron's avatar Alejandro Homs Puron Committed by Generic Bliss account for Control Software

Add Warning message when Command data does not fit in buffer

parent c6f26c4b
Pipeline #33614 passed with stages
in 9 minutes and 2 seconds
......@@ -409,6 +409,9 @@ size_t Requests::Command::_write_callback(char *ptr,size_t size,
if (cmd->check_http_response(ptr, len))
return len;
int size_to_copy = std::min(len, sizeof(m_data) - 1);
if (size_to_copy < len)
std::cout << "Requests::Command: Warning: not enough place to store message: "
<< std::string(ptr, size_to_copy) << std::endl;
memcpy(cmd->m_data,ptr,size_to_copy);
cmd->m_data[size_to_copy] = '\0';
return size_to_copy;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment