summary refs log tree commit diff
path: root/elf/ldconfig.c
diff options
context:
space:
mode:
authorJakub Jelinek <jakub@redhat.com>2007-04-13 19:53:20 +0000
committerJakub Jelinek <jakub@redhat.com>2007-04-13 19:53:20 +0000
commit30a3aa753041e9506b6183dc1ad06257f7693192 (patch)
treeb05d5a4ff56fe90c9f5699177fdd80743b5018ea /elf/ldconfig.c
parent75587bfeeeb4c7d8c72e14fbfde5479754d1b103 (diff)
downloadglibc-30a3aa753041e9506b6183dc1ad06257f7693192.tar.gz
glibc-30a3aa753041e9506b6183dc1ad06257f7693192.tar.xz
glibc-30a3aa753041e9506b6183dc1ad06257f7693192.zip
[BZ #4344]
* elf/ldconfig.c (search_dir): Fix 2 off-by-2 errors. 
Reported by David Anderson <davea42@earthlink.net>.
2007-04-13  Jakub Jelinek  <jakub@redhat.com>

	[BZ #4344]
	* elf/ldconfig.c (search_dir): Fix 2 off-by-2 errors.
	Reported by David Anderson <davea42@earthlink.net>.
Diffstat (limited to 'elf/ldconfig.c')
-rw-r--r--elf/ldconfig.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/elf/ldconfig.c b/elf/ldconfig.c
index ec81cbb817..44ccc1a3d4 100644
--- a/elf/ldconfig.c
+++ b/elf/ldconfig.c
@@ -707,10 +707,10 @@ search_dir (const struct dir_entry *entry)
 			 + 1, ".#prelink#.", sizeof (".#prelink#.") - 1) == 0)
 	    continue;
 	}
-      len += strlen (entry->path);
+      len += strlen (entry->path) + 2;
       if (len > file_name_len)
 	{
-	  file_name_len = len + 1;
+	  file_name_len = len;
 	  file_name = alloca (file_name_len);
 	  if (!opt_chroot)
 	    real_file_name = file_name;
@@ -718,10 +718,10 @@ search_dir (const struct dir_entry *entry)
       sprintf (file_name, "%s/%s", entry->path, direntry->d_name);
       if (opt_chroot)
 	{
-	  len = strlen (dir_name) + strlen (direntry->d_name);
+	  len = strlen (dir_name) + strlen (direntry->d_name) + 2;
 	  if (len > real_file_name_len)
 	    {
-	      real_file_name_len = len + 1;
+	      real_file_name_len = len;
 	      real_file_name = alloca (real_file_name_len);
 	    }
 	  sprintf (real_file_name, "%s/%s", dir_name, direntry->d_name);