From f0786d1fcd312eac5f3b104f3763b4863b5af344 Mon Sep 17 00:00:00 2001 From: Maxim Biro Date: Fri, 9 Aug 2013 19:16:51 -0400 Subject: [PATCH] Returned the length check --- core/Messenger.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/core/Messenger.c b/core/Messenger.c index 89fc290b..5f33886f 100644 --- a/core/Messenger.c +++ b/core/Messenger.c @@ -236,6 +236,8 @@ uint32_t m_sendmessage(int friendnumber, uint8_t *message, uint32_t length) uint32_t m_sendmessage_withid(int friendnumber, uint32_t theid, uint8_t *message, uint32_t length) { + if (length >= (MAX_DATA_SIZE - sizeof(theid))) + return 0; uint8_t temp[MAX_DATA_SIZE]; theid = htonl(theid); memcpy(temp, &theid, sizeof(theid));