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

forgot a few string nulls

This commit is contained in:
Jfreegman 2014-04-01 02:48:37 -04:00
parent 08f57de9e0
commit 6d98f38128
No known key found for this signature in database
GPG Key ID: 3627F3144076AE63
2 changed files with 16 additions and 5 deletions

View File

@ -173,7 +173,7 @@ static void chat_onAction(ToxWindow *self, Tox *m, int32_t num, uint8_t *action,
ChatContext *ctx = self->chatwin;
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);;
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 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;
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"
"Type \"/join\" to join the chat.", name);
line_info_add(self, NULL, NULL, NULL, msg, SYS_MSG, 0, 0);

View File

@ -369,13 +369,20 @@ static void prompt_onConnectionChange(ToxWindow *self, Tox *m, int32_t friendnum
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;
if (!nick[0])
n_len = MIN(n_len, TOXIC_MAX_NAME_LENGTH);
if (!nick[0]) {
snprintf(nick, sizeof(nick), "%s", UNKNOWN_NAME);
n_len = strlen(UNKNOWN_NAME);
}
nick[n_len] = '\0';
uint8_t timefrmt[TIME_STR_SIZE];
get_time_str(timefrmt);