mirror of
https://github.com/Tha14/toxic.git
synced 2024-11-16 04:03:02 +01:00
null fix
This commit is contained in:
parent
d873181306
commit
1b89af9063
@ -335,8 +335,8 @@ void cmd_nick(WINDOW *window, ToxWindow *self, Tox *m, int argc, char (*argv)[MA
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (len > TOXIC_MAX_NAME_LENGTH) {
|
if (len > TOXIC_MAX_NAME_LENGTH) {
|
||||||
nick[TOXIC_MAX_NAME_LENGTH] = L'\0';
|
|
||||||
len = TOXIC_MAX_NAME_LENGTH;
|
len = TOXIC_MAX_NAME_LENGTH;
|
||||||
|
nick[len-1] = L'\0';
|
||||||
}
|
}
|
||||||
|
|
||||||
tox_set_name(m, nick, len+1);
|
tox_set_name(m, nick, len+1);
|
||||||
|
@ -304,7 +304,7 @@ static void groupchat_onGroupNamelistChange(ToxWindow *self, Tox *m, int groupnu
|
|||||||
event = " is now known as ";
|
event = " is now known as ";
|
||||||
line_info_add(self, timefrmt, oldpeername, peername, event, NAME_CHANGE, 0, 0);
|
line_info_add(self, timefrmt, oldpeername, peername, event, NAME_CHANGE, 0, 0);
|
||||||
|
|
||||||
uint8_t tmp_event[TOXIC_MAX_NAME_LENGTH + 32];
|
uint8_t tmp_event[TOXIC_MAX_NAME_LENGTH * 2 + 32];
|
||||||
snprintf(tmp_event, sizeof(tmp_event), "is now known as %s", peername);
|
snprintf(tmp_event, sizeof(tmp_event), "is now known as %s", peername);
|
||||||
write_to_log(tmp_event, oldpeername, ctx->log, true);
|
write_to_log(tmp_event, oldpeername, ctx->log, true);
|
||||||
break;
|
break;
|
||||||
|
@ -118,16 +118,16 @@ void line_info_add(ToxWindow *self, uint8_t *tmstmp, uint8_t *name1, uint8_t *na
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (msg) {
|
if (msg) {
|
||||||
memcpy(new_line->msg, msg, MAX_STR_SIZE);
|
memcpy(new_line->msg, msg, sizeof(new_line->msg));
|
||||||
len += strlen(msg);
|
len += strlen(msg);
|
||||||
} if (tmstmp) {
|
} if (tmstmp) {
|
||||||
memcpy(new_line->timestamp, tmstmp, TIME_STR_SIZE);
|
memcpy(new_line->timestamp, tmstmp, sizeof(new_line->timestamp));
|
||||||
len += strlen(tmstmp);
|
len += strlen(tmstmp);
|
||||||
} if (name1) {
|
} if (name1) {
|
||||||
memcpy(new_line->name1, name1, TOXIC_MAX_NAME_LENGTH);
|
memcpy(new_line->name1, name1, sizeof(new_line->name1));
|
||||||
len += strlen(name1);
|
len += strlen(name1);
|
||||||
} if (name2) {
|
} if (name2) {
|
||||||
memcpy(new_line->name2, name2, TOXIC_MAX_NAME_LENGTH);
|
memcpy(new_line->name2, name2, sizeof(new_line->name2));
|
||||||
len += strlen(name2);
|
len += strlen(name2);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user