Index: lib/filesys.cpp =================================================================== --- lib/filesys.cpp.orig +++ lib/filesys.cpp @@ -47,6 +47,7 @@ #include #include #include +#include #if HAVE_SYS_RESOURCE_H #include @@ -412,7 +413,8 @@ } while (FindNextFileA(hFind, &findData)); ::FindClose(hFind); #else - char filename[1024], subdir[1024]; + char filename[PATH_MAX]; + char *subdir;; int retval=0; DIRREF dirp; double x; @@ -423,7 +425,7 @@ while (1) { retval = dir_scan(filename, dirp, sizeof(filename)); if (retval) break; - sprintf(subdir, "%s/%s", dirpath, filename); + asprintf(&subdir, "%s/%s", dirpath, filename); if (is_dir(subdir)) { if (recurse) { @@ -436,6 +438,9 @@ if (retval) continue; size += x; } + + if(subdir != NULL) + free(subdir); } dir_close(dirp); #endif