[debian-hurd-Patches][302785] #344722: opensp
Patches item #302785, was opened at 25/12/2005 03:10
>Status: Closed
Priority: 3
Submitted By: Michael Banck (mbanck)
Assigned to: Nobody (None)
Summary: #344722: opensp
Category: posix
Group: needs-work
>Resolution: Fixed
Initial Comment:
Author: Michael Banck <mbanck@debian.org>
Source: opensp
Status: submitted, but hacky
Categories: posix
Strip-level: -p1
----------------------------------------------------------------------
Comment By: Christopher Bodenstein (physicman-guest)
Date: 05/05/2006 15:36
Message:
Logged In: YES
user_id=11528
New version that assigns values in the case where neither MAXPATHLEN nor __GLIBC__ are defined.
----------------------------------------------------------------------
Comment By: Christopher Bodenstein (physicman-guest)
Date: 11/04/2006 20:27
Message:
Logged In: YES
user_id=11528
Here is a new version of the patch where I removed the first two malloc() that were introduced and rather use realpath() with a second NULL attribute if on __GLIBC__
----------------------------------------------------------------------
Comment By: Christopher Bodenstein (physicman-guest)
Date: 27/02/2006 21:38
Message:
Logged In: YES
user_id=11528
Here is a small (and probably ugly) patch to remove a couple of MAXPATHLEN instances.
--- opensp-1.5.2.orig/sx/XmlOutputEventHandler.cxx 2005-08-26 22:08:19.000000000 +0200
+++ opensp-1.5.2/sx/XmlOutputEventHandler.cxx 2006-02-27 19:45:58.000000000 +0100
@@ -1199,10 +1199,12 @@ void XmlOutputEventHandler::inputOpened(
// Check to make sure we haven't passed outside of the
// output directory
char *dirs = strdup (filePath);
- char realDirs[MAXPATHLEN];
- char realOutputDir[MAXPATHLEN];
+ char *realDirs;
+ char *realOutputDir;
char *outputDir = strdup(outputDir_);
+ realDirs = (char *)malloc(strlen(filePath) +1);
+ realOutputDir = (char *)malloc(strlen(outputDir_) +1);
realpath((const char *)dirname(dirs), realDirs);
realpath((const char *)dirname(outputDir), realOutputDir);
@@ -1214,6 +1216,8 @@ void XmlOutputEventHandler::inputOpened(
}
}
+ free(realDirs);
+ free(realOutputDir);
// Make the necessary directories
maybeCreateDirectories(dirname(dirs));
@@ -1652,7 +1656,7 @@ void NullOutputByteStream::flushBuf(char
#ifdef _MSC_VER
char* dirname(const char* path)
{
- static char buffer[MAXPATHLEN];
+ static char *buffer;
char* p=strrchr((char*)path,'/');
#ifdef SP_MSDOS_FILENAMES
char *ppp = strrchr((char*)path,'\\');
@@ -1660,9 +1664,11 @@ char* dirname(const char* path)
#endif
if (p==NULL) return NULL;
+ buffer = malloc(strlen(p-path)+1);
strncpy(buffer,path,p-path);
buffer[p-path]=0;
return buffer;
+ free(buffer);
}
void realpath(const char* in,char* out)
----------------------------------------------------------------------
You can respond by visiting:
http://alioth.debian.org/tracker/?func=detail&atid=410472&aid=302785&group_id=30628
Reply to: