File: patch.344722

package info (click to toggle)
opensp 1.5.2-3
  • links: PTS
  • area: main
  • in suites: etch, etch-m68k
  • size: 8,900 kB
  • ctags: 10,028
  • sloc: cpp: 65,784; ansic: 17,124; sh: 11,255; xml: 2,704; makefile: 899; perl: 561; yacc: 288; sed: 16
file content (37 lines) | stat: -rw-r--r-- 1,154 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
--- opensp-1.5.2.orig/sx/XmlOutputEventHandler.cxx
+++ opensp-1.5.2/sx/XmlOutputEventHandler.cxx
@@ -1199,12 +1199,22 @@
           // Check to make sure we haven't passed outside of the
           // output directory
 	  char *dirs = strdup (filePath);
+#ifdef MAXPATHLEN
           char realDirs[MAXPATHLEN];
           char realOutputDir[MAXPATHLEN];
+#else
+          char *realDirs;
+          char *realOutputDir;
+#endif
           char *outputDir = strdup(outputDir_);
 
+#ifdef MAXPATHLEN
           realpath((const char *)dirname(dirs), realDirs);
           realpath((const char *)dirname(outputDir), realOutputDir);
+#else
+          realDirs = realpath((const char *)dirname(dirs), NULL);
+          realOutputDir = realpath((const char *)dirname(outputDir), NULL);
+#endif
 
           if (strncmp(realDirs, realOutputDir, strlen (realOutputDir)) != 0) {
             app_->message(XmlOutputMessages::pathOutsideOutputDirectory,
@@ -1214,6 +1224,11 @@
             }
           }
 
+#ifndef MAXPATHLEN
+	  free(realDirs);
+	  free(realOutputDir);
+#endif
+
 	  // Make the necessary directories
 	  maybeCreateDirectories(dirname(dirs));