From 9495b2e66f772783eb89cfa755e1e09641fa44eb Mon Sep 17 00:00:00 2001 From: Alan Modra Date: Tue, 14 Oct 2014 13:30:57 +1030 Subject: [PATCH] Correct fscanf char field count %s as an fscanf format does not include the trailing NULL. PATH_MAX does include the trailing NULL. PR 17453 * readelf.c (process_program_headers): Correct fscanf format used for interpreter. --- binutils/ChangeLog | 10 ++++++++-- binutils/readelf.c | 2 +- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/binutils/ChangeLog b/binutils/ChangeLog index 34d65fc..b6800f1 100644 --- a/binutils/ChangeLog +++ b/binutils/ChangeLog @@ -1,3 +1,9 @@ +2014-10-14 Alan Modra + + PR 17453 + * readelf.c (process_program_headers): Correct fscanf format used + for interpreter. + 2014-10-09 Jose E. Marchesi * readelf.c (display_sparc_hwcaps2): New function. @@ -287,8 +293,8 @@ 2014-03-14 Meador Inge - * dwarf.c (strnlen): Move prototype ... - * sysdep.h (strnlen): ... to here. + * dwarf.c (strnlen): Move prototype ... + * sysdep.h (strnlen): ... to here. 2014-03-12 Nick Clifton diff --git a/binutils/readelf.c b/binutils/readelf.c index 3cf46d8..58ccd93 100644 --- a/binutils/readelf.c +++ b/binutils/readelf.c @@ -4394,7 +4394,7 @@ process_program_headers (FILE * file) else { char fmt [32]; - int ret = snprintf (fmt, sizeof (fmt), "%%%ds", PATH_MAX); + int ret = snprintf (fmt, sizeof (fmt), "%%%ds", PATH_MAX - 1); if (ret >= (int) sizeof (fmt) || ret < 0) error (_("Internal error: failed to create format string to display program interpreter\n")); -- 2.7.4