mirror of
https://github.com/Tha14/toxic.git
synced 2024-11-23 01:33:02 +01:00
null terminate status message
This commit is contained in:
parent
02e6d2db3c
commit
0bc610e18d
@ -298,7 +298,9 @@ static void prompt_onDraw(ToxWindow *self, Tox *m)
|
|||||||
char statusmsg[TOX_MAX_STATUS_MESSAGE_LENGTH];
|
char statusmsg[TOX_MAX_STATUS_MESSAGE_LENGTH];
|
||||||
|
|
||||||
pthread_mutex_lock(&Winthread.lock);
|
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);
|
pthread_mutex_unlock(&Winthread.lock);
|
||||||
|
|
||||||
snprintf(statusbar->statusmsg, sizeof(statusbar->statusmsg), "%s", statusmsg);
|
snprintf(statusbar->statusmsg, sizeof(statusbar->statusmsg), "%s", statusmsg);
|
||||||
|
@ -339,7 +339,9 @@ static void mplex_timer_handler (Tox *m)
|
|||||||
prev_status = current_status;
|
prev_status = current_status;
|
||||||
new_status = TOX_USER_STATUS_AWAY;
|
new_status = TOX_USER_STATUS_AWAY;
|
||||||
pthread_mutex_lock (&Winthread.lock);
|
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);
|
tox_self_get_status_message (m, (uint8_t*) prev_note);
|
||||||
|
prev_note[slen] = '\0';
|
||||||
pthread_mutex_unlock (&Winthread.lock);
|
pthread_mutex_unlock (&Winthread.lock);
|
||||||
new_note = user_settings->mplex_away_note;
|
new_note = user_settings->mplex_away_note;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user