diff options
-rw-r--r-- | core/Messenger.c | 14 |
1 files changed, 6 insertions, 8 deletions
diff --git a/core/Messenger.c b/core/Messenger.c index 1bd0d541..58e6085f 100644 --- a/core/Messenger.c +++ b/core/Messenger.c | |||
@@ -47,8 +47,9 @@ uint8_t self_public_key[crypto_box_PUBLICKEYBYTES]; | |||
47 | static uint8_t self_name[MAX_NAME_LENGTH]; | 47 | static uint8_t self_name[MAX_NAME_LENGTH]; |
48 | static uint16_t self_name_length; | 48 | static uint16_t self_name_length; |
49 | 49 | ||
50 | static uint8_t *self_statusmessage; | 50 | static uint8_t self_statusmessage[MAX_STATUSMESSAGE_LENGTH]; |
51 | static uint16_t self_statusmessage_len; | 51 | static uint16_t self_statusmessage_length; |
52 | |||
52 | static USERSTATUS self_userstatus; | 53 | static USERSTATUS self_userstatus; |
53 | 54 | ||
54 | static Friend *friendlist; | 55 | static Friend *friendlist; |
@@ -315,11 +316,8 @@ int m_set_statusmessage(uint8_t *status, uint16_t length) | |||
315 | { | 316 | { |
316 | if (length > MAX_STATUSMESSAGE_LENGTH) | 317 | if (length > MAX_STATUSMESSAGE_LENGTH) |
317 | return -1; | 318 | return -1; |
318 | uint8_t *newstatus = calloc(length, 1); | 319 | memcpy(self_statusmessage, status, length); |
319 | memcpy(newstatus, status, length); | 320 | self_statusmessage_length = length; |
320 | free(self_statusmessage); | ||
321 | self_statusmessage = newstatus; | ||
322 | self_statusmessage_len = length; | ||
323 | 321 | ||
324 | uint32_t i; | 322 | uint32_t i; |
325 | for (i = 0; i < numfriends; ++i) | 323 | for (i = 0; i < numfriends; ++i) |
@@ -565,7 +563,7 @@ static void doFriends(void) | |||
565 | friendlist[i].name_sent = 1; | 563 | friendlist[i].name_sent = 1; |
566 | } | 564 | } |
567 | if (friendlist[i].statusmessage_sent == 0) { | 565 | if (friendlist[i].statusmessage_sent == 0) { |
568 | if (send_statusmessage(i, self_statusmessage, self_statusmessage_len)) | 566 | if (send_statusmessage(i, self_statusmessage, self_statusmessage_length)) |
569 | friendlist[i].statusmessage_sent = 1; | 567 | friendlist[i].statusmessage_sent = 1; |
570 | } | 568 | } |
571 | if (friendlist[i].userstatus_sent == 0) { | 569 | if (friendlist[i].userstatus_sent == 0) { |