mirror of
https://github.com/Tha14/toxic.git
synced 2024-11-26 22:03:27 +01:00
fix another possible buffer overflow
..
This commit is contained in:
parent
848b4e9a4c
commit
7206a9ea73
@ -214,8 +214,11 @@ static void chat_onStatusMessageChange(ToxWindow *self, int32_t num, uint8_t *st
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
StatusBar *statusbar = self->stb;
|
StatusBar *statusbar = self->stb;
|
||||||
|
|
||||||
|
status[len] = '\0';
|
||||||
|
snprintf(statusbar->statusmsg, sizeof(statusbar->statusmsg), "%s", status);
|
||||||
|
len = strlen(statusbar->statusmsg);
|
||||||
statusbar->statusmsg_len = len;
|
statusbar->statusmsg_len = len;
|
||||||
strcpy(statusbar->statusmsg, status);
|
|
||||||
statusbar->statusmsg[len] = '\0';
|
statusbar->statusmsg[len] = '\0';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -162,9 +162,11 @@ static void friendlist_onStatusMessageChange(ToxWindow *self, int32_t num, uint8
|
|||||||
if (len > TOX_MAX_STATUSMESSAGE_LENGTH || num >= max_friends_index)
|
if (len > TOX_MAX_STATUSMESSAGE_LENGTH || num >= max_friends_index)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
strcpy(friends[num].statusmsg, str);
|
str[len] = '\0';
|
||||||
friends[num].statusmsg[len] = '\0';
|
snprintf(friends[num].statusmsg, sizeof(friends[num].statusmsg), "%s", str);
|
||||||
|
len = strlen(friends[num].statusmsg);
|
||||||
friends[num].statusmsg_len = len;
|
friends[num].statusmsg_len = len;
|
||||||
|
friends[num].statusmsg[len] = '\0';
|
||||||
}
|
}
|
||||||
|
|
||||||
void friendlist_onFriendAdded(ToxWindow *self, Tox *m, int32_t num, bool sort)
|
void friendlist_onFriendAdded(ToxWindow *self, Tox *m, int32_t num, bool sort)
|
||||||
|
@ -74,7 +74,7 @@ void prompt_update_nick(ToxWindow *prompt, uint8_t *nick, uint16_t len)
|
|||||||
{
|
{
|
||||||
StatusBar *statusbar = prompt->stb;
|
StatusBar *statusbar = prompt->stb;
|
||||||
snprintf(statusbar->nick, sizeof(statusbar->nick), "%s", nick);
|
snprintf(statusbar->nick, sizeof(statusbar->nick), "%s", nick);
|
||||||
statusbar->nick_len = len;
|
statusbar->nick_len = strlen(statusbar->nick);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Updates own statusmessage in prompt statusbar */
|
/* Updates own statusmessage in prompt statusbar */
|
||||||
@ -82,7 +82,7 @@ void prompt_update_statusmessage(ToxWindow *prompt, uint8_t *statusmsg, uint16_t
|
|||||||
{
|
{
|
||||||
StatusBar *statusbar = prompt->stb;
|
StatusBar *statusbar = prompt->stb;
|
||||||
snprintf(statusbar->statusmsg, sizeof(statusbar->statusmsg), "%s", statusmsg);
|
snprintf(statusbar->statusmsg, sizeof(statusbar->statusmsg), "%s", statusmsg);
|
||||||
statusbar->statusmsg_len = len;
|
statusbar->statusmsg_len = strlen(statusbar->statusmsg);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Updates own status in prompt statusbar */
|
/* Updates own status in prompt statusbar */
|
||||||
|
Loading…
Reference in New Issue
Block a user