From 4f4a379a01fac8a9a50546814d4654732d0d31fb Mon Sep 17 00:00:00 2001 From: "Coren[m]" Date: Sat, 30 Nov 2013 22:14:09 +0100 Subject: [PATCH] Fix partial fix: A slash in pos 0 still led to read access to pathname[-1]. --- src/chat.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/chat.c b/src/chat.c index a74f506..48f2047 100644 --- a/src/chat.c +++ b/src/chat.c @@ -114,7 +114,7 @@ static void chat_onFileSendRequest(ToxWindow *self, Tox *m, int num, uint8_t fil ChatContext *ctx = self->chatwin; int idx = strlen(pathname) - 1; - while (pathname[idx] == '/' && idx >= 0) { + while (idx >= 0 && pathname[idx] == '/') { pathname[idx--] = 0; }