From owner-freebsd-bugs Mon Apr 15 15:24:29 2002 Delivered-To: freebsd-bugs@freebsd.org Received: from salmon.maths.tcd.ie (salmon.maths.tcd.ie [134.226.81.11]) by hub.freebsd.org (Postfix) with SMTP id 8FC5E37B41B for ; Mon, 15 Apr 2002 15:24:22 -0700 (PDT) Received: from lanczos.maths.tcd.ie by salmon.maths.tcd.ie with SMTP id ; 15 Apr 2002 23:24:21 +0100 (BST) Date: Mon, 15 Apr 2002 23:24:19 +0100 From: David Malone To: Thomas Quinot Cc: freebsd-bugs@FreeBSD.org Subject: Re: bin/37104 [PATCH] Message-ID: <20020415222419.GA46761@lanczos.maths.tcd.ie> References: <200204152110.g3FLA2M65236@freefall.freebsd.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <200204152110.g3FLA2M65236@freefall.freebsd.org> User-Agent: Mutt/1.3.25i Sender: owner-freebsd-bugs@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.org On Mon, Apr 15, 2002 at 02:10:02PM -0700, Thomas Quinot wrote: > The following patch seems to fix the problem. Addresses on the stack are > beyond 2**31, i.e. a negative long. Changing the offset parameter > to an off_t and using fseeko allows the correct seek to be made. > > addresses on the stack are beyond 2**31, i.e. some negative long value. I wonder would uintptr_t be better than unsigned long in the patch? David. > --- usr.bin/truss/dist/syscalls.c Mon Apr 15 22:44:49 2002 > +++ usr.bin/truss/syscalls.c Mon Apr 15 22:48:18 2002 > @@ -137,7 +137,7 @@ > err(1, "dup"); > if ((p = fdopen(fd, "r")) == NULL) > err(1, "fdopen"); > - fseek(p, (long)offset, SEEK_SET); > + fseeko(p, (unsigned long)offset, SEEK_SET); > for (pos = (char *)buf; len--; pos++) { > if ((c = fgetc(p)) == EOF) > return -1; > @@ -167,7 +167,7 @@ > buf = malloc( size = (max ? max : 64 ) ); > len = 0; > buf[0] = 0; > - fseek(p, (long)offset, SEEK_SET); > + fseeko(p, (unsigned long)offset, SEEK_SET); > while ((c = fgetc(p)) != EOF) { > buf[len++] = c; > if (c == 0 || len == max) { To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-bugs" in the body of the message