[uClibc-cvs] uClibc/ldso/util ldd.c,1.30,1.31

Erik Andersen andersen at uclibc.org
Sun Jun 15 06:13:40 UTC 2003


Update of /var/cvs/uClibc/ldso/util
In directory winder:/tmp/cvs-serv17688/ldso/util

Modified Files:
	ldd.c 
Log Message:
Don't segfault when given things other than a regular file.
 -Erik


Index: ldd.c
===================================================================
RCS file: /var/cvs/uClibc/ldso/util/ldd.c,v
retrieving revision 1.30
retrieving revision 1.31
diff -u -d -r1.30 -r1.31
--- ldd.c	7 Mar 2003 12:23:11 -0000	1.30
+++ ldd.c	15 Jun 2003 06:13:36 -0000	1.31
@@ -503,6 +503,9 @@
 	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);



More information about the uClibc-cvs mailing list