1
0
mirror of https://github.com/Tha14/toxic.git synced 2024-11-27 01:03:26 +01:00

fix possible segfault

This commit is contained in:
Jfreegman 2014-04-02 18:57:11 -04:00
parent 20f126e1d8
commit 246a514e88
No known key found for this signature in database
GPG Key ID: 3627F3144076AE63

View File

@ -312,9 +312,12 @@ static void groupchat_onGroupNamelistChange(ToxWindow *self, Tox *m, int groupnu
/* get current peername then sort namelist */
uint8_t peername[TOX_MAX_NAME_LENGTH];
if (change != TOX_CHAT_CHANGE_PEER_DEL) {
uint16_t n_len = groupchats[groupnum].peer_name_lengths[peernum];
memcpy(peername, &groupchats[groupnum].peer_names[peernum*TOX_MAX_NAME_LENGTH], sizeof(peername));
peername[n_len] = '\0';
}
qsort(groupchats[groupnum].peer_names, groupchats[groupnum].num_peers, TOX_MAX_NAME_LENGTH, qsort_strcasecmp_hlpr);