mirror of
https://github.com/Tha14/toxic.git
synced 2024-11-23 02:33:02 +01:00
core: Fix a possible buffer overflow using getself_name().
If the passed buffer is smaller than MAX_NAME_LENGTH then, you will probably overflow it.
This commit is contained in:
parent
b5a4cac6e1
commit
98ecf06b4c
2
chat.c
2
chat.c
@ -210,7 +210,7 @@ void execute(ToxWindow *self, ChatContext *ctx, Messenger *m, char *cmd, struct
|
|||||||
wattroff(ctx->history, COLOR_PAIR(2));
|
wattroff(ctx->history, COLOR_PAIR(2));
|
||||||
|
|
||||||
uint8_t selfname[MAX_NAME_LENGTH];
|
uint8_t selfname[MAX_NAME_LENGTH];
|
||||||
int len = getself_name(m, selfname);
|
int len = getself_name(m, selfname, sizeof(selfname));
|
||||||
char msg[MAX_STR_SIZE-len-4];
|
char msg[MAX_STR_SIZE-len-4];
|
||||||
snprintf(msg, sizeof(msg), "* %s %s\n", (uint8_t*) selfname, action);
|
snprintf(msg, sizeof(msg), "* %s %s\n", (uint8_t*) selfname, action);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user