From 889b08e7656a5975f033bdf87ff4bf6366d03606 Mon Sep 17 00:00:00 2001 From: Eric Andersen Date: Sun, 15 Jun 2003 06:13:36 +0000 Subject: Don't segfault when given things other than a regular file. -Erik --- ldso/util/ldd.c | 3 +++ 1 file changed, 3 insertions(+) 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); -- cgit v1.2.3