From dc@dhcp-168-0-25.packetdesign.com  Thu Dec 14 10:06:24 2000
Return-Path: <dc@dhcp-168-0-25.packetdesign.com>
Received: from dhcp-168-0-25.packetdesign.com (dns.PACKETDESIGN.NET [216.15.46.10])
	by hub.freebsd.org (Postfix) with ESMTP id 1A62B37B400
	for <FreeBSD-gnats-submit@freebsd.org>; Thu, 14 Dec 2000 10:06:24 -0800 (PST)
Received: (from dc@localhost)
	by dhcp-168-0-25.packetdesign.com (8.11.0/8.9.3) id eBEI6Kd08742;
	Thu, 14 Dec 2000 10:06:20 -0800 (PST)
	(envelope-from dc)
Message-Id: <200012141806.eBEI6Kd08742@dhcp-168-0-25.packetdesign.com>
Date: Thu, 14 Dec 2000 10:06:20 -0800 (PST)
From: dc@packetdesign.com
Sender: dc@dhcp-168-0-25.packetdesign.com
Reply-To: dc@packetdesign.com
To: FreeBSD-gnats-submit@freebsd.org
Subject: ldd invokes 'lseek' incorrectly
X-Send-Pr-Version: 3.2

>Number:         23549
>Category:       bin
>Synopsis:       ldd invokes 'lseek' incorrectly
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-bugs
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Thu Dec 14 10:10:02 PST 2000
>Closed-Date:    Wed Jan 10 00:11:16 PST 2001
>Last-Modified:  Wed Jan 10 00:11:45 PST 2001
>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:
State-Changed-From-To: open->analyzed 
State-Changed-By: ache 
State-Changed-When: Fri Dec 15 05:40:47 PST 2000 
State-Changed-Why:  
Fixed in -current ldd.c v1.21 

http://www.freebsd.org/cgi/query-pr.cgi?pr=23549 
State-Changed-From-To: analyzed->closed 
State-Changed-By: ache 
State-Changed-When: Wed Jan 10 00:11:16 PST 2001 
State-Changed-Why:  
Commited into -stable 

http://www.freebsd.org/cgi/query-pr.cgi?pr=23549 
>Unformatted:
