From 47d5060c1b2d163fa92670b2efc3e21625884508 Mon Sep 17 00:00:00 2001 From: vivek-shankar Date: Fri, 27 Jan 2017 05:20:56 -0500 Subject: [PATCH] addition of safety against illformed msg --- src/CommunicationManager.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/CommunicationManager.cpp b/src/CommunicationManager.cpp index d896a88..16f5b62 100644 --- a/src/CommunicationManager.cpp +++ b/src/CommunicationManager.cpp @@ -373,8 +373,8 @@ inline void CommunicationManager::Check_In_Messages_and_Transfer_To_Topics() ¤t_int64); header = u64_cvt_u16(current_int64); std::cout << "Received header" <size(); i++) + if(header[3]==1 && header[0]==0){ + for (std::size_t i = 1; i < in_message->size()-1; i++) { if (' ' == in_message->at(i) || 0 == i) @@ -389,7 +389,7 @@ inline void CommunicationManager::Check_In_Messages_and_Transfer_To_Topics() mavlink_publisher_.publish(mavlink_msg); delete[] header; } - else if (header[3]>1){ + else if (header[3]>1 && header[0]==0){ std::cout << "Multi packet: check_cur:"<