mirror of
https://oauth2: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@github.com/m1ngsama/TNT.git
synced 2026-05-10 19:00:57 +08:00
fix: suppress GCC format-truncation warning in exec /me handler
This commit is contained in:
parent
dedb61aec1
commit
6dfd66ed66
1 changed files with 4 additions and 1 deletions
|
|
@ -1009,7 +1009,10 @@ static int exec_command_post(client_t *client, const char *args) {
|
||||||
if (strncmp(content, "/me ", 4) == 0 && content[4] != '\0') {
|
if (strncmp(content, "/me ", 4) == 0 && content[4] != '\0') {
|
||||||
msg.username[0] = '*';
|
msg.username[0] = '*';
|
||||||
msg.username[1] = '\0';
|
msg.username[1] = '\0';
|
||||||
snprintf(msg.content, sizeof(msg.content), "%s %s", username, content + 4);
|
int n = snprintf(msg.content, sizeof(msg.content), "%s %s", username, content + 4);
|
||||||
|
if (n >= (int)sizeof(msg.content)) {
|
||||||
|
msg.content[sizeof(msg.content) - 1] = '\0';
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
strncpy(msg.username, username, sizeof(msg.username) - 1);
|
strncpy(msg.username, username, sizeof(msg.username) - 1);
|
||||||
msg.username[sizeof(msg.username) - 1] = '\0';
|
msg.username[sizeof(msg.username) - 1] = '\0';
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue