mirror of
https://github.com/Tha14/toxic.git
synced 2024-11-23 02:13:01 +01:00
forgot a few string nulls
This commit is contained in:
parent
08f57de9e0
commit
6d98f38128
@ -173,7 +173,7 @@ static void chat_onAction(ToxWindow *self, Tox *m, int32_t num, uint8_t *action,
|
|||||||
ChatContext *ctx = self->chatwin;
|
ChatContext *ctx = self->chatwin;
|
||||||
|
|
||||||
uint8_t nick[TOX_MAX_NAME_LENGTH];
|
uint8_t nick[TOX_MAX_NAME_LENGTH];
|
||||||
int n_len = tox_get_name(m, num, nick);
|
uint16_t n_len = tox_get_name(m, num, nick);
|
||||||
|
|
||||||
n_len = MIN(n_len, TOXIC_MAX_NAME_LENGTH);;
|
n_len = MIN(n_len, TOXIC_MAX_NAME_LENGTH);;
|
||||||
nick[n_len] = '\0';
|
nick[n_len] = '\0';
|
||||||
@ -350,10 +350,14 @@ static void chat_onGroupInvite(ToxWindow *self, Tox *m, int32_t friendnumber, ui
|
|||||||
|
|
||||||
uint8_t name[TOX_MAX_NAME_LENGTH];
|
uint8_t name[TOX_MAX_NAME_LENGTH];
|
||||||
uint8_t msg[MAX_STR_SIZE];
|
uint8_t msg[MAX_STR_SIZE];
|
||||||
|
int n_len;
|
||||||
|
|
||||||
if (tox_get_name(m, friendnumber, name) == -1)
|
if (n_len = tox_get_name(m, friendnumber, name) == -1)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
n_len = MIN(n_len, TOXIC_MAX_NAME_LENGTH);
|
||||||
|
name[n_len] = '\0';
|
||||||
|
|
||||||
snprintf(msg, sizeof(msg), "%s has invited you to a group chat.\n"
|
snprintf(msg, sizeof(msg), "%s has invited you to a group chat.\n"
|
||||||
"Type \"/join\" to join the chat.", name);
|
"Type \"/join\" to join the chat.", name);
|
||||||
line_info_add(self, NULL, NULL, NULL, msg, SYS_MSG, 0, 0);
|
line_info_add(self, NULL, NULL, NULL, msg, SYS_MSG, 0, 0);
|
||||||
|
13
src/prompt.c
13
src/prompt.c
@ -369,13 +369,20 @@ static void prompt_onConnectionChange(ToxWindow *self, Tox *m, int32_t friendnum
|
|||||||
|
|
||||||
ChatContext *ctx = self->chatwin;
|
ChatContext *ctx = self->chatwin;
|
||||||
|
|
||||||
uint8_t nick[TOX_MAX_NAME_LENGTH] = {'\0'};
|
uint8_t nick[TOX_MAX_NAME_LENGTH];
|
||||||
|
uint16_t n_len;
|
||||||
|
|
||||||
if (tox_get_name(m, friendnum, nick) == -1)
|
if (n_len = tox_get_name(m, friendnum, nick) == -1)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (!nick[0])
|
n_len = MIN(n_len, TOXIC_MAX_NAME_LENGTH);
|
||||||
|
|
||||||
|
if (!nick[0]) {
|
||||||
snprintf(nick, sizeof(nick), "%s", UNKNOWN_NAME);
|
snprintf(nick, sizeof(nick), "%s", UNKNOWN_NAME);
|
||||||
|
n_len = strlen(UNKNOWN_NAME);
|
||||||
|
}
|
||||||
|
|
||||||
|
nick[n_len] = '\0';
|
||||||
|
|
||||||
uint8_t timefrmt[TIME_STR_SIZE];
|
uint8_t timefrmt[TIME_STR_SIZE];
|
||||||
get_time_str(timefrmt);
|
get_time_str(timefrmt);
|
||||||
|
Loading…
Reference in New Issue
Block a user