1
0
forked from pool/boinc-client
boinc-client/boinc-client-7.0.36-dynamic_buffers.patch
2013-10-28 10:17:07 +00:00

42 lines
1022 B
Diff

Index: lib/filesys.cpp
===================================================================
--- lib/filesys.cpp.orig
+++ lib/filesys.cpp
@@ -47,6 +47,7 @@
#include <sys/time.h>
#include <unistd.h>
#include <dirent.h>
+#include <climits>
#if HAVE_SYS_RESOURCE_H
#include <sys/resource.h>
@@ -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