diff options
Diffstat (limited to 'core/Messenger.c')
-rw-r--r-- | core/Messenger.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/core/Messenger.c b/core/Messenger.c index a14be9d0..8e22f448 100644 --- a/core/Messenger.c +++ b/core/Messenger.c | |||
@@ -325,7 +325,7 @@ int m_copy_userstatus(int friendnumber, uint8_t * buf, uint32_t maxlen) | |||
325 | { | 325 | { |
326 | return -1; | 326 | return -1; |
327 | } | 327 | } |
328 | memset(buf, 0, 1); | 328 | memset(buf, 0, maxlen); |
329 | memcpy(buf, friendlist[friendnumber].userstatus, MIN(maxlen, MAX_USERSTATUS_LENGTH) - 1); | 329 | memcpy(buf, friendlist[friendnumber].userstatus, MIN(maxlen, MAX_USERSTATUS_LENGTH) - 1); |
330 | return 0; | 330 | return 0; |
331 | } | 331 | } |
@@ -335,7 +335,9 @@ static int send_userstatus(int friendnumber, uint8_t * status, uint16_t length) | |||
335 | uint8_t *thepacket = malloc(length + 1); | 335 | uint8_t *thepacket = malloc(length + 1); |
336 | memcpy(thepacket + 1, status, length); | 336 | memcpy(thepacket + 1, status, length); |
337 | thepacket[0] = 70; | 337 | thepacket[0] = 70; |
338 | return write_cryptpacket(friendlist[friendnumber].crypt_connection_id, thepacket, length + 1); | 338 | int written = write_cryptpacket(friendlist[friendnumber].crypt_connection_id, thepacket, length + 1); |
339 | free(thepacket); | ||
340 | return written; | ||
339 | } | 341 | } |
340 | 342 | ||
341 | static int set_friend_userstatus(int friendnumber, uint8_t * status, uint16_t length) | 343 | static int set_friend_userstatus(int friendnumber, uint8_t * status, uint16_t length) |