diff --git a/src/prompt.c b/src/prompt.c index 24346d3..79d5d40 100644 --- a/src/prompt.c +++ b/src/prompt.c @@ -299,7 +299,9 @@ static void prompt_onDraw(ToxWindow *self, Tox *m) char statusmsg[TOX_MAX_STATUS_MESSAGE_LENGTH]; pthread_mutex_lock(&Winthread.lock); - tox_self_get_status_message(m, (uint8_t *) statusmsg); + size_t slen = tox_self_get_status_message_size(m); + tox_self_get_status_message (m, (uint8_t*) statusmsg); + statusmsg[slen] = '\0'; pthread_mutex_unlock(&Winthread.lock); snprintf(statusbar->statusmsg, sizeof(statusbar->statusmsg), "%s", statusmsg); diff --git a/src/term_mplex.c b/src/term_mplex.c index 0036b73..130e868 100644 --- a/src/term_mplex.c +++ b/src/term_mplex.c @@ -339,7 +339,9 @@ static void mplex_timer_handler (Tox *m) prev_status = current_status; new_status = TOX_USER_STATUS_AWAY; pthread_mutex_lock (&Winthread.lock); + size_t slen = tox_self_get_status_message_size(m); tox_self_get_status_message (m, (uint8_t*) prev_note); + prev_note[slen] = '\0'; pthread_mutex_unlock (&Winthread.lock); new_note = user_settings->mplex_away_note; }