This is the mail archive of the libc-hacker@sources.redhat.com mailing list for the glibc project.

Note that libc-hacker is a closed list. You may look at the archives of this list, but subscription and posting are not open.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Check for ET_DYN in ldconfig


Here's another sanity check: We check that a shared library is indeed
a shared object.

Ok to commit?

Andreas

2003-07-22  Andreas Jaeger  <aj@suse.de>

	* elf/readlib.c (process_file): Check that file is a shared
	object.

============================================================
Index: elf/readlib.c
--- elf/readlib.c	5 Sep 2002 18:51:48 -0000	1.13
+++ elf/readlib.c	22 Jul 2003 11:11:42 -0000
@@ -1,4 +1,4 @@
-/* Copyright (C) 1999, 2000, 2001, 2002 Free Software Foundation, Inc.
+/* Copyright (C) 1999, 2000, 2001, 2002, 2003 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Andreas Jaeger <aj@suse.de>, 1999 and
 		  Jakub Jelinek <jakub@redhat.com>, 1999.
@@ -157,6 +157,13 @@ process_file (const char *real_file_name
 	  && memmem (file_contents, len, "GNU ld script", 13) == NULL)
 	error (0, 0, _("%s is not an ELF file - it has the wrong magic bytes at the start.\n"),
 	       file_name);
+      ret = 1;
+      goto done;
+    }
+
+  /* Libraries have to be shared object files.  */
+  if (!elf_header->e_type & ET_DYN)
+    {
       ret = 1;
       goto done;
     }

-- 
 Andreas Jaeger, aj@suse.de, http://www.suse.de/~aj
  SuSE Linux AG, Deutschherrnstr. 15-19, 90429 Nürnberg, Germany
   GPG fingerprint = 93A3 365E CE47 B889 DF7F  FED1 389A 563C C272 A126


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]