summaryrefslogtreecommitdiffstats
path: root/usr.bin/ldd
diff options
context:
space:
mode:
authorsobomax <sobomax@FreeBSD.org>2002-02-08 04:08:57 +0000
committersobomax <sobomax@FreeBSD.org>2002-02-08 04:08:57 +0000
commitd491ac2a48c3ae912f1cd6d2b39bf8f845c6f124 (patch)
treeff869e905f9f8078a84396e3e38379e64545c34b /usr.bin/ldd
parentbfa45f9454fd5b884988a46f39918e6acd9428d0 (diff)
downloadFreeBSD-src-d491ac2a48c3ae912f1cd6d2b39bf8f845c6f124.zip
FreeBSD-src-d491ac2a48c3ae912f1cd6d2b39bf8f845c6f124.tar.gz
Inspect ELF header and reject any non-FreeBSD shared objects.
MFC after: 2 weeks
Diffstat (limited to 'usr.bin/ldd')
-rw-r--r--usr.bin/ldd/ldd.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/usr.bin/ldd/ldd.c b/usr.bin/ldd/ldd.c
index 0d86e66..fc20467 100644
--- a/usr.bin/ldd/ldd.c
+++ b/usr.bin/ldd/ldd.c
@@ -171,7 +171,13 @@ char *argv[];
warnx("%s: not a dynamic executable", *argv);
file_ok = 0;
} else if (hdr.elf.e_type == ET_DYN) {
- is_shlib = 1;
+ if (hdr.elf.e_ident[EI_OSABI] & ELFOSABI_FREEBSD) {
+ is_shlib = 1;
+ } else {
+ warnx("%s: not a FreeBSD ELF shared "
+ "object", *argv);
+ file_ok = 0;
+ }
}
} else {
warnx("%s: not a dynamic executable", *argv);
OpenPOWER on IntegriCloud