Date: Thu, 14 Dec 2000 10:06:20 -0800 (PST) From: dc@packetdesign.com To: FreeBSD-gnats-submit@freebsd.org Subject: bin/23549: ldd invokes 'lseek' incorrectly Message-ID: <200012141806.eBEI6Kd08742@dhcp-168-0-25.packetdesign.com> Resent-Message-ID: <200012141810.eBEIA2Y13995@freefall.freebsd.org>
next in thread | raw e-mail | index | archive | help
>Number: 23549
>Category: bin
>Synopsis: ldd invokes 'lseek' incorrectly
>Confidential: no
>Severity: non-critical
>Priority: low
>Responsible: freebsd-bugs
>State: open
>Quarter:
>Keywords:
>Date-Required:
>Class: sw-bug
>Submitter-Id: current-users
>Arrival-Date: Thu Dec 14 10:10:02 PST 2000
>Closed-Date:
>Last-Modified:
>Originator: Dave Cornelius
>Release: FreeBSD 4.1-20000929-STABLE i386
>Organization:
Packet Design
>Environment:
see above.
>Description:
ldd invokes 'lseek' with an offset in the 3rd arg when
trying to move to the start of the program header
array in an elf file.
>How-To-Repeat:
inspect the code, or:
"truss ldd yourprog" and watch for the EINVAL from lseek.
>Fix:
===================================================================
RCS file: /home/cvs/freebsd/src/usr.bin/ldd/ldd.c,v
retrieving revision 1.18
diff -u -r1.18 ldd.c
--- ldd.c 1999/08/28 01:02:43 1.18
+++ ldd.c 2000/12/14 18:00:56
@@ -153,7 +153,7 @@
warnx("%s: can't read program header", *argv);
file_ok = 0;
}
- lseek(fd, 0, ehdr.e_phoff);
+ lseek(fd, ehdr.e_phoff, SEEK_SET);
for (i = 0; i < ehdr.e_phnum; i++) {
if (read(fd, &phdr, ehdr.e_phentsize)
!= sizeof phdr) {
>Release-Note:
>Audit-Trail:
>Unformatted:
To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-bugs" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200012141806.eBEI6Kd08742>
