Skip to content

Commit

Permalink
- Fix crash bug on NetBSD and OpenBSD. MAXPATHLEN didn't get defined
Browse files Browse the repository at this point in the history
  correctly and caused a stack overrun. This was *hard* to debug.
  • Loading branch information
Andi Gutmans committed Sep 7, 2000
1 parent 204f4ad commit fe434a0
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 7 deletions.
5 changes: 4 additions & 1 deletion TSRM/configure.in
Expand Up @@ -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,[ ])
Expand Down
21 changes: 21 additions & 0 deletions TSRM/tsrm_config_common.h
Expand Up @@ -7,6 +7,7 @@

#ifndef TSRM_WIN32
# include "tsrm_config.h"
# include <sys/param.h>
#else
# include "tsrm_config.w32.h"
#endif
Expand All @@ -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)
Expand Down
6 changes: 0 additions & 6 deletions TSRM/tsrm_virtual_cwd.c
Expand Up @@ -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
Expand Down

0 comments on commit fe434a0

Please sign in to comment.