mirror of
https://github.com/Tha14/toxic.git
synced 2024-11-23 15:03:03 +01:00
fix possible segfault
This commit is contained in:
parent
20f126e1d8
commit
246a514e88
@ -312,9 +312,12 @@ static void groupchat_onGroupNamelistChange(ToxWindow *self, Tox *m, int groupnu
|
|||||||
|
|
||||||
/* get current peername then sort namelist */
|
/* get current peername then sort namelist */
|
||||||
uint8_t peername[TOX_MAX_NAME_LENGTH];
|
uint8_t peername[TOX_MAX_NAME_LENGTH];
|
||||||
|
|
||||||
|
if (change != TOX_CHAT_CHANGE_PEER_DEL) {
|
||||||
uint16_t n_len = groupchats[groupnum].peer_name_lengths[peernum];
|
uint16_t n_len = groupchats[groupnum].peer_name_lengths[peernum];
|
||||||
memcpy(peername, &groupchats[groupnum].peer_names[peernum*TOX_MAX_NAME_LENGTH], sizeof(peername));
|
memcpy(peername, &groupchats[groupnum].peer_names[peernum*TOX_MAX_NAME_LENGTH], sizeof(peername));
|
||||||
peername[n_len] = '\0';
|
peername[n_len] = '\0';
|
||||||
|
}
|
||||||
|
|
||||||
qsort(groupchats[groupnum].peer_names, groupchats[groupnum].num_peers, TOX_MAX_NAME_LENGTH, qsort_strcasecmp_hlpr);
|
qsort(groupchats[groupnum].peer_names, groupchats[groupnum].num_peers, TOX_MAX_NAME_LENGTH, qsort_strcasecmp_hlpr);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user