diff options
author | Eric Andersen <andersen@codepoet.org> | 2003-06-15 06:13:36 +0000 |
---|---|---|
committer | Eric Andersen <andersen@codepoet.org> | 2003-06-15 06:13:36 +0000 |
commit | 889b08e7656a5975f033bdf87ff4bf6366d03606 (patch) | |
tree | ef596e3b76c153ed4e52689921d28fd773f37d34 /ldso/util | |
parent | a8d9ee1f663268a01583923a792d5ede5cd4a0f8 (diff) |
Don't segfault when given things other than a regular file.
-Erik
Diffstat (limited to 'ldso/util')
-rw-r--r-- | ldso/util/ldd.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/ldso/util/ldd.c b/ldso/util/ldd.c index defc91cfd..661fb865f 100644 --- a/ldso/util/ldd.c +++ b/ldso/util/ldd.c @@ -503,6 +503,9 @@ int find_dependancies(char* filename) if ((size_t)statbuf.st_size < sizeof(Elf32_Ehdr)) goto foo; + if (!S_ISREG(statbuf.st_mode)) + goto foo; + /* mmap the file to make reading stuff from it effortless */ ehdr = (Elf32_Ehdr *)mmap(0, statbuf.st_size, PROT_READ|PROT_WRITE, MAP_PRIVATE, fileno(thefile), 0); |