Browse Source

Don't segfault when given things other than a regular file.
-Erik

Eric Andersen 21 years ago
parent
commit
889b08e765
1 changed files with 3 additions and 0 deletions
  1. 3 0
      ldso/util/ldd.c

+ 3 - 0
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);