2006-10-29 H.J. Lu <hongjiu.lu@intel.com>
PR binutils/3384 * configure.in (AC_CHECK_HEADERS): Add limits.h and sys/param.h. * configure: Regenerated. * config.in: Likewise. * readelf.c: Include <limits.h> and <sys/param.h> for PATH_MAX. (program_interpreter): Allocate PATH_MAX bytes instead of 64. (process_program_headers): Don't assume that program interpreter is shorter than 64 characters.
This commit is contained in:
parent
e2785c4472
commit
f8eae8b28b
4 changed files with 43 additions and 4 deletions
|
@ -1,3 +1,15 @@
|
||||||
|
2006-10-29 H.J. Lu <hongjiu.lu@intel.com>
|
||||||
|
|
||||||
|
PR binutils/3384
|
||||||
|
* configure.in (AC_CHECK_HEADERS): Add limits.h and sys/param.h.
|
||||||
|
* configure: Regenerated.
|
||||||
|
* config.in: Likewise.
|
||||||
|
|
||||||
|
* readelf.c: Include <limits.h> and <sys/param.h> for PATH_MAX.
|
||||||
|
(program_interpreter): Allocate PATH_MAX bytes instead of 64.
|
||||||
|
(process_program_headers): Don't assume that program interpreter
|
||||||
|
is shorter than 64 characters.
|
||||||
|
|
||||||
2006-10-25 Trevor Smigiel <Trevor_Smigiel@playstation.sony.com>
|
2006-10-25 Trevor Smigiel <Trevor_Smigiel@playstation.sony.com>
|
||||||
Yukishige Shibata <shibata@rd.scei.sony.co.jp>
|
Yukishige Shibata <shibata@rd.scei.sony.co.jp>
|
||||||
Nobuhisa Fujinami <fnami@rd.scei.sony.co.jp>
|
Nobuhisa Fujinami <fnami@rd.scei.sony.co.jp>
|
||||||
|
|
4
binutils/configure
vendored
4
binutils/configure
vendored
|
@ -6425,7 +6425,9 @@ done
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
for ac_header in string.h strings.h stdlib.h unistd.h fcntl.h sys/file.h
|
|
||||||
|
|
||||||
|
for ac_header in string.h strings.h stdlib.h unistd.h fcntl.h sys/file.h limits.h sys/param.h
|
||||||
do
|
do
|
||||||
as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh`
|
as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh`
|
||||||
if eval "test \"\${$as_ac_Header+set}\" = set"; then
|
if eval "test \"\${$as_ac_Header+set}\" = set"; then
|
||||||
|
|
|
@ -80,7 +80,7 @@ case "${host}" in
|
||||||
esac
|
esac
|
||||||
AC_SUBST(DEMANGLER_NAME)
|
AC_SUBST(DEMANGLER_NAME)
|
||||||
|
|
||||||
AC_CHECK_HEADERS(string.h strings.h stdlib.h unistd.h fcntl.h sys/file.h)
|
AC_CHECK_HEADERS(string.h strings.h stdlib.h unistd.h fcntl.h sys/file.h limits.h sys/param.h)
|
||||||
AC_HEADER_SYS_WAIT
|
AC_HEADER_SYS_WAIT
|
||||||
AC_FUNC_ALLOCA
|
AC_FUNC_ALLOCA
|
||||||
AC_CHECK_FUNCS(sbrk utimes setmode getc_unlocked strcoll)
|
AC_CHECK_FUNCS(sbrk utimes setmode getc_unlocked strcoll)
|
||||||
|
|
|
@ -47,6 +47,25 @@
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <time.h>
|
#include <time.h>
|
||||||
|
|
||||||
|
/* for PATH_MAX */
|
||||||
|
#ifdef HAVE_LIMITS_H
|
||||||
|
#include <limits.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef PATH_MAX
|
||||||
|
/* for MAXPATHLEN */
|
||||||
|
# ifdef HAVE_SYS_PARAM_H
|
||||||
|
# include <sys/param.h>
|
||||||
|
# endif
|
||||||
|
# ifndef PATH_MAX
|
||||||
|
# ifdef MAXPATHLEN
|
||||||
|
# define PATH_MAX MAXPATHLEN
|
||||||
|
# else
|
||||||
|
# define PATH_MAX 1024
|
||||||
|
# endif
|
||||||
|
# endif
|
||||||
|
#endif
|
||||||
|
|
||||||
#if __GNUC__ >= 2
|
#if __GNUC__ >= 2
|
||||||
/* Define BFD64 here, even if our default architecture is 32 bit ELF
|
/* Define BFD64 here, even if our default architecture is 32 bit ELF
|
||||||
as this will allow us to read in and parse 64bit and 32bit ELF files.
|
as this will allow us to read in and parse 64bit and 32bit ELF files.
|
||||||
|
@ -135,7 +154,7 @@ static Elf_Internal_Sym *dynamic_symbols;
|
||||||
static Elf_Internal_Syminfo *dynamic_syminfo;
|
static Elf_Internal_Syminfo *dynamic_syminfo;
|
||||||
static unsigned long dynamic_syminfo_offset;
|
static unsigned long dynamic_syminfo_offset;
|
||||||
static unsigned int dynamic_syminfo_nent;
|
static unsigned int dynamic_syminfo_nent;
|
||||||
static char program_interpreter[64];
|
static char program_interpreter[PATH_MAX];
|
||||||
static bfd_vma dynamic_info[DT_JMPREL + 1];
|
static bfd_vma dynamic_info[DT_JMPREL + 1];
|
||||||
static bfd_vma dynamic_info_DT_GNU_HASH;
|
static bfd_vma dynamic_info_DT_GNU_HASH;
|
||||||
static bfd_vma version_info[16];
|
static bfd_vma version_info[16];
|
||||||
|
@ -3492,8 +3511,14 @@ process_program_headers (FILE *file)
|
||||||
error (_("Unable to find program interpreter name\n"));
|
error (_("Unable to find program interpreter name\n"));
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
char fmt [32];
|
||||||
|
int ret = snprintf (fmt, sizeof (fmt), "%%%ds", PATH_MAX);
|
||||||
|
|
||||||
|
if (ret >= (int) sizeof (fmt) || ret < 0)
|
||||||
|
error (_("Internal error: failed to create format string to display program interpreter"));
|
||||||
|
|
||||||
program_interpreter[0] = 0;
|
program_interpreter[0] = 0;
|
||||||
fscanf (file, "%63s", program_interpreter);
|
fscanf (file, fmt, program_interpreter);
|
||||||
|
|
||||||
if (do_segments)
|
if (do_segments)
|
||||||
printf (_("\n [Requesting program interpreter: %s]"),
|
printf (_("\n [Requesting program interpreter: %s]"),
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue