From 70415bf8dd9eeed5f70854f66e0eab085f80e7c0 Mon Sep 17 00:00:00 2001 From: Johns Date: Fri, 15 Feb 2013 16:15:38 +0100 Subject: Disables AVFS, which produces memory corruption. --- TODO.txt | 2 +- readdir.c | 12 +++++++++--- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/TODO.txt b/TODO.txt index a941b3d..8db24e4 100644 --- a/TODO.txt +++ b/TODO.txt @@ -1,2 +1,2 @@ - +Can autodetect color key. ffodivxvdpau not always supported. diff --git a/readdir.c b/readdir.c index 2a5e400..f150783 100644 --- a/readdir.c +++ b/readdir.c @@ -1,7 +1,7 @@ /// /// @file readdir.c @brief directory reading module /// -/// Copyright (c) 2012 by Johns. All Rights Reserved. +/// Copyright (c) 2012, 2013 by Johns. All Rights Reserved. /// /// Contributor(s): /// @@ -23,6 +23,10 @@ #define __USE_ZZIPLIB ///< zip archives support #define __USE_AVFS ///< A Virtual File System support +#ifdef USE_AVFS +#error "Version 1.0.1 of AVFS has memory corruption". +#endif + #include #include @@ -61,6 +65,7 @@ const char ConfigShowHiddenFiles = 0; ///< config show hidden files static const char *BaseDir; ///< current directory +static int BaseDirLen; ///< length of current directory name static const NameFilter *NameFilters; ///< current name filter table ////////////////////////////////////////////////////////////////////////////// @@ -167,7 +172,7 @@ static int FilterIsDirectory(const struct dirent *dirent) #endif // DT_UNKOWN or DT_LNK - tmp = (char *)malloc(strlen(BaseDir) + strlen(dirent->d_name) + 1); + tmp = malloc(BaseDirLen + len + 1); stpcpy(stpcpy(tmp, BaseDir), dirent->d_name); dir = IsDirectory(tmp); free(tmp); @@ -220,7 +225,7 @@ static int FilterIsFile(const struct dirent *dirent) #endif // DT_UNKOWN or DT_LNK - tmp = (char *)malloc(strlen(BaseDir) + strlen(dirent->d_name) + 1); + tmp = malloc(BaseDirLen + len + 1); stpcpy(stpcpy(tmp, BaseDir), dirent->d_name); dir = IsDirectory(tmp); free(tmp); @@ -272,6 +277,7 @@ int ScanDirectory(const char *name, int flag_dir, const NameFilter * filter, // FIXME: threads remove global variables BaseDir = name; + BaseDirLen = strlen(BaseDir); NameFilters = filter; if (!(dir = virt_opendir(name))) { -- cgit v1.2.3