Source: xplc Version: 0.3.13-3 Severity: important Tags: patch Usertags: hurd User: debian-h...@lists.debian.org
Hi, xplc fails to build due to PATH_MAX issues. The attached patch solves this problem by using dynamic allocation of the needed strings. It also adds inclusion of two header files needed. These are checked for in the configure script already. Thanks!
--- a/xplc/modulemgr.cpp 2004-09-30 23:09:54.000000000 +0200 +++ b/xplc/modulemgr.cpp 2012-08-30 20:43:10.000000000 +0200 @@ -29,6 +29,12 @@ #ifdef HAVE_STDINT_H # include <stdint.h> #endif +#ifdef HAVE_STDLIB_H +# include <stdlib.h> +#endif +#ifdef HAVE_STRING_H +# include <string.h> +#endif #ifdef HAVE_LIMITS_H # include <limits.h> #endif @@ -83,7 +89,8 @@ #if !defined(WIN32) DIR* dir; struct dirent* ent; - char fname[PATH_MAX]; + char *fname = NULL; + int len = 0; IServiceManager* servmgr = XPLC_getServiceManager(); IModuleLoader* loader; ModuleNode* modules = 0; @@ -106,7 +113,10 @@ while((ent = readdir(dir))) { IModule* module; - snprintf(fname, PATH_MAX, "%s/%s", directory, ent->d_name); + len = strlen(directory) + 1 + strlen(ent->d_name) + 1; + free(fname); + fname = (char*)malloc(len); + snprintf(fname, len, "%s/%s", directory, ent->d_name); module = loader->loadModule(fname); if(module) { @@ -117,6 +127,7 @@ } } + free(fname); loader->release(); closedir(dir);