1
0
mirror of https://github.com/Tha14/toxic.git synced 2024-07-01 16:37:46 +02:00

Fix trailing slashes which leads to segfault.

This commit is contained in:
AZ Huang 2013-11-28 03:25:56 +08:00
parent eab41ccd3d
commit bb5ee93c88

View File

@ -109,6 +109,11 @@ 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] == '/') {
pathname[idx--] = 0;
}
/* try to get file name from path */
uint8_t *filename = strrchr(pathname, '/'); // Try unix style paths