summaryrefslogtreecommitdiff
path: root/TSRM
diff options
context:
space:
mode:
authorAndi Gutmans <andi@php.net>2000-09-07 15:31:29 +0000
committerAndi Gutmans <andi@php.net>2000-09-07 15:31:29 +0000
commitfe434a05b4ab7ababaf6941296037f4cf55f7f72 (patch)
tree73db93f45f27b3c8ec1ff745517f4915143d8b97 /TSRM
parent204f4adca72fc5dfd29c1c6e89655f85aba83c47 (diff)
downloadphp-git-fe434a05b4ab7ababaf6941296037f4cf55f7f72.tar.gz
- Fix crash bug on NetBSD and OpenBSD. MAXPATHLEN didn't get defined
correctly and caused a stack overrun. This was *hard* to debug.
Diffstat (limited to 'TSRM')
-rw-r--r--TSRM/configure.in5
-rw-r--r--TSRM/tsrm_config_common.h21
-rw-r--r--TSRM/tsrm_virtual_cwd.c6
3 files changed, 25 insertions, 7 deletions
diff --git a/TSRM/configure.in b/TSRM/configure.in
index 2b4f81908b..da5cb2953c 100644
--- a/TSRM/configure.in
+++ b/TSRM/configure.in
@@ -22,7 +22,10 @@ dnl TSRM_PTHREAD
AC_CHECK_HEADERS(
utime.h \
dirent.h \
-stdarg.h
+stdarg.h \
+alloca.h \
+unistd.h \
+limits.h
)
AC_DEFINE(ZTS,1,[ ])
diff --git a/TSRM/tsrm_config_common.h b/TSRM/tsrm_config_common.h
index f549117792..8b80f80121 100644
--- a/TSRM/tsrm_config_common.h
+++ b/TSRM/tsrm_config_common.h
@@ -7,6 +7,7 @@
#ifndef TSRM_WIN32
# include "tsrm_config.h"
+# include <sys/param.h>
#else
# include "tsrm_config.w32.h"
#endif
@@ -15,6 +16,26 @@
#include <malloc.h>
#endif
+#if HAVE_ALLOCA_H
+#include <alloca.h>
+#endif
+
+#if HAVE_UNISTD_H
+#include <unistd.h>
+#endif
+
+#if HAVE_LIMITS_H
+#include <limits.h>
+#endif
+
+#ifndef MAXPATHLEN
+# ifdef PATH_MAX
+# define MAXPATHLEN PATH_MAX
+# else
+# define MAXPATHLEN 256
+# endif
+#endif
+
#if (HAVE_ALLOCA || (defined (__GNUC__) && __GNUC__ >= 2))
# define tsrm_do_alloca(p) alloca(p)
# define tsrm_free_alloca(p)
diff --git a/TSRM/tsrm_virtual_cwd.c b/TSRM/tsrm_virtual_cwd.c
index e19a8b2513..facfdfce04 100644
--- a/TSRM/tsrm_virtual_cwd.c
+++ b/TSRM/tsrm_virtual_cwd.c
@@ -31,12 +31,6 @@
#include "tsrm_virtual_cwd.h"
#include "tsrm_strtok_r.h"
-
-/* Are we doing enough to detect this? */
-#ifndef MAXPATHLEN
-#define MAXPATHLEN 256
-#endif
-
#ifdef TSRM_WIN32
#include <io.h>
#endif