| 1 | Adapted from https://sources.debian.org/src/opensp/1.5.2-15.2/debian/patches/diff-1.0.patch
|
| 2 |
|
| 3 | Index: OpenSP-1.5.2/sx/XmlOutputEventHandler.cxx
|
| 4 | ===================================================================
|
| 5 | |
| 6 | |
| 7 | @@ -1199,12 +1199,22 @@ void XmlOutputEventHandler::inputOpened(
|
| 8 | // Check to make sure we haven't passed outside of the
|
| 9 | // output directory
|
| 10 | char *dirs = strdup (filePath);
|
| 11 | +#ifdef MAXPATHLEN
|
| 12 | char realDirs[MAXPATHLEN];
|
| 13 | char realOutputDir[MAXPATHLEN];
|
| 14 | +#else
|
| 15 | + char *realDirs;
|
| 16 | + char *realOutputDir;
|
| 17 | +#endif
|
| 18 | char *outputDir = strdup(outputDir_);
|
| 19 |
|
| 20 | +#ifdef MAXPATHLEN
|
| 21 | realpath((const char *)dirname(dirs), realDirs);
|
| 22 | realpath((const char *)dirname(outputDir), realOutputDir);
|
| 23 | +#else
|
| 24 | + realDirs = realpath((const char *)dirname(dirs), NULL);
|
| 25 | + realOutputDir = realpath((const char *)dirname(outputDir), NULL);
|
| 26 | +#endif
|
| 27 |
|
| 28 | if (strncmp(realDirs, realOutputDir, strlen (realOutputDir)) != 0) {
|
| 29 | app_->message(XmlOutputMessages::pathOutsideOutputDirectory,
|
| 30 | @@ -1214,6 +1224,11 @@ void XmlOutputEventHandler::inputOpened(
|
| 31 | }
|
| 32 | }
|
| 33 |
|
| 34 | +#ifndef MAXPATHLEN
|
| 35 | + free(realDirs);
|
| 36 | + free(realOutputDir);
|
| 37 | +#endif
|
| 38 | +
|
| 39 | // Make the necessary directories
|
| 40 | maybeCreateDirectories(dirname(dirs));
|
| 41 |
|