diff options
author | sobomax <sobomax@FreeBSD.org> | 2002-02-08 04:08:57 +0000 |
---|---|---|
committer | sobomax <sobomax@FreeBSD.org> | 2002-02-08 04:08:57 +0000 |
commit | d491ac2a48c3ae912f1cd6d2b39bf8f845c6f124 (patch) | |
tree | ff869e905f9f8078a84396e3e38379e64545c34b /usr.bin/ldd/ldd.c | |
parent | bfa45f9454fd5b884988a46f39918e6acd9428d0 (diff) | |
download | FreeBSD-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/ldd.c')
-rw-r--r-- | usr.bin/ldd/ldd.c | 8 |
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); |