Add checking maximum raw message size 17/103217/2
authorAlexander Aksenov <a.aksenov@samsung.com>
Wed, 7 Dec 2016 15:02:12 +0000 (18:02 +0300)
committerDmitry Kovalenko <d.kovalenko@samsung.com>
Fri, 9 Dec 2016 12:19:06 +0000 (04:19 -0800)
It's max size is the same as in writer module.
Svace issue.

Change-Id: Icc5d34e67533ab675af35cd2398daf5b9be860d3
Signed-off-by: Alexander Aksenov <a.aksenov@samsung.com>
daemon/da_protocol.h
daemon/threads.c

index 9e2f160..647849c 100644 (file)
@@ -40,6 +40,9 @@
 
 #define PROTOCOL_VERSION "4.2"
 
+enum {
+       MAX_RAW_MESSAGE_SIZE = 8*1024,
+};
 
 #include "da_msg_ids.h"
 
index 20d4158..61cbcc9 100644 (file)
@@ -104,6 +104,12 @@ static void* recvThread(void* data)
                if (IS_PROBE_MSG(log.type)) {
                        struct msg_data_t *msg_data = (struct msg_data_t *)&log;
 
+                       if (msg_data->len > MAX_RAW_MESSAGE_SIZE) {
+                               LOGE("Raw message is too big = %d\n",
+                                    msg_data->len);
+                               continue;
+                       }
+
                        if (write_to_buf(msg_data) != 0)
                                LOGE("write to buf fail\n");