From 98ecf06b4cce0bb7fc3664ee8de3c01859c52f7a Mon Sep 17 00:00:00 2001 From: Andreas Schneider Date: Sun, 11 Aug 2013 15:24:47 +0200 Subject: [PATCH] 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. --- chat.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/chat.c b/chat.c index 112b20b..59b1349 100644 --- a/chat.c +++ b/chat.c @@ -210,7 +210,7 @@ void execute(ToxWindow *self, ChatContext *ctx, Messenger *m, char *cmd, struct wattroff(ctx->history, COLOR_PAIR(2)); 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]; snprintf(msg, sizeof(msg), "* %s %s\n", (uint8_t*) selfname, action);