From e21e5c18ff5ce0f2e1d0b0db54775e1dbbfe25fb Mon Sep 17 00:00:00 2001 From: irungentoo Date: Thu, 28 Nov 2013 19:52:30 -0500 Subject: [PATCH] Fix possible crash. --- src/chat.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/chat.c b/src/chat.c index ddc475d..9d94763 100644 --- a/src/chat.c +++ b/src/chat.c @@ -110,7 +110,7 @@ static void chat_onFileSendRequest(ToxWindow *self, Tox *m, int num, uint8_t fil ChatContext *ctx = (ChatContext *) self->chatwin; int idx = strlen(pathname) - 1; - while (pathname[idx] == '/') { + while (pathname[idx] == '/' && idx >= 0) { pathname[idx--] = 0; }