summaryrefslogtreecommitdiff
path: root/gnu/usr.bin/ld
diff options
context:
space:
mode:
authorMarc Espie <espie@cvs.openbsd.org>2001-08-30 10:42:02 +0000
committerMarc Espie <espie@cvs.openbsd.org>2001-08-30 10:42:02 +0000
commit6dc71867c8c216f5fefaf57c984cea9d0886b654 (patch)
treec6b0fa6ff1737237f2acd805ff8d4a44e103886f /gnu/usr.bin/ld
parentdc237c57e70e0a7c3400103f7e9757f87d6b4bfc (diff)
Detect broken libraries that reference themselves.
Abort immediately, instead of gobbling all memory. ok fgs@
Diffstat (limited to 'gnu/usr.bin/ld')
-rw-r--r--gnu/usr.bin/ld/lib.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/gnu/usr.bin/ld/lib.c b/gnu/usr.bin/ld/lib.c
index 25030ffa4c5..6a57d7b511b 100644
--- a/gnu/usr.bin/ld/lib.c
+++ b/gnu/usr.bin/ld/lib.c
@@ -1,4 +1,4 @@
-/* * $OpenBSD: lib.c,v 1.2 1998/03/26 19:46:21 niklas Exp $ - library routines*/
+/* * $OpenBSD: lib.c,v 1.3 2001/08/30 10:42:01 espie Exp $ - library routines*/
/*
*/
@@ -730,6 +730,12 @@ read_shared_object(fd, entry)
subentry->filename = strdup(name);
subentry->local_sym_name = strdup(name);
}
+ /* Sanity check */
+ if (strcmp(subentry->filename,
+ subentry->superfile->filename) == 0)
+ errx(1, "loop in library dependencies: %s",
+ subentry->filename);
+
read_file_symbols(subentry);
if (prev)