Use LD_PATHMAX+1 to account for trailing '\0'.
authorNick Clifton <nickc@redhat.com>
Tue, 17 Dec 2002 11:01:25 +0000 (11:01 +0000)
committerNick Clifton <nickc@redhat.com>
Tue, 17 Dec 2002 11:01:25 +0000 (11:01 +0000)
ld/ChangeLog
ld/emultempl/pe.em

index 02d9e4234d74a8cf053e9673c79973eafb597c93..2a84e6223e2fed8dd25391dd3fd061d0b2bfe047 100644 (file)
@@ -1,3 +1,8 @@
+2002-12-17  Danny Smith  <dannysmith@users.sourceforge.net>
+
+       * emultempl/pe.em (..._recognized_file): Use LD_PATHMAX+1 to
+       account for trailing '\0'.
+
 2002-12-17  Nick Clifton  <nickc@redhat.com>
 
        * emultempl/pe.em (longopts): Duplicate entry for --compact-implib
index 061401f26fbee8f253841c40cd08dbf7334bd0c8..27a059daeec6647910a19846a95d1f075c4c2c84 100644 (file)
@@ -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;