diff options
author | Maxim Biro <nurupo.contributions@gmail.com> | 2013-08-09 19:16:51 -0400 |
---|---|---|
committer | Maxim Biro <nurupo.contributions@gmail.com> | 2013-08-09 19:20:23 -0400 |
commit | f0786d1fcd312eac5f3b104f3763b4863b5af344 (patch) | |
tree | 7734080f0a255a64eeafd366c9cd5144324c0af9 /core | |
parent | 0f8eea89fab7e3e219819d9c7eee65b454ddab7e (diff) |
Returned the length check
Diffstat (limited to 'core')
-rw-r--r-- | core/Messenger.c | 2 |
1 files changed, 2 insertions, 0 deletions
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) | |||
236 | 236 | ||
237 | uint32_t m_sendmessage_withid(int friendnumber, uint32_t theid, uint8_t *message, uint32_t length) | 237 | uint32_t m_sendmessage_withid(int friendnumber, uint32_t theid, uint8_t *message, uint32_t length) |
238 | { | 238 | { |
239 | if (length >= (MAX_DATA_SIZE - sizeof(theid))) | ||
240 | return 0; | ||
239 | uint8_t temp[MAX_DATA_SIZE]; | 241 | uint8_t temp[MAX_DATA_SIZE]; |
240 | theid = htonl(theid); | 242 | theid = htonl(theid); |
241 | memcpy(temp, &theid, sizeof(theid)); | 243 | memcpy(temp, &theid, sizeof(theid)); |