From: Nick Clifton Date: Tue, 17 Dec 2002 11:01:25 +0000 (+0000) Subject: Use LD_PATHMAX+1 to account for trailing '\0'. X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=2a8ac465c4b542038e321e806ae27d301ad1fca5;p=binutils-gdb.git Use LD_PATHMAX+1 to account for trailing '\0'. --- diff --git a/ld/ChangeLog b/ld/ChangeLog index 02d9e4234d7..2a84e6223e2 100644 --- a/ld/ChangeLog +++ b/ld/ChangeLog @@ -1,3 +1,8 @@ +2002-12-17 Danny Smith + + * emultempl/pe.em (..._recognized_file): Use LD_PATHMAX+1 to + account for trailing '\0'. + 2002-12-17 Nick Clifton * emultempl/pe.em (longopts): Duplicate entry for --compact-implib diff --git a/ld/emultempl/pe.em b/ld/emultempl/pe.em index 061401f26fb..27a059daeec 100644 --- a/ld/emultempl/pe.em +++ b/ld/emultempl/pe.em @@ -1392,11 +1392,11 @@ gld_${EMULATION_NAME}_recognized_file (entry) #endif if (bfd_get_format (entry->the_bfd) == bfd_object) { - char fbuf[LD_PATHMAX]; + char fbuf[LD_PATHMAX + 1]; const char *ext; if (REALPATH (entry->filename, fbuf) == NULL) - strncpy (fbuf, entry->filename, LD_PATHMAX); + strncpy (fbuf, entry->filename, sizeof (fbuf)); ext = fbuf + strlen (fbuf) - 4;