From owner-freebsd-bugs Mon Apr 15 14:10:42 2002 Delivered-To: freebsd-bugs@hub.freebsd.org Received: from freefall.freebsd.org (freefall.FreeBSD.org [216.136.204.21]) by hub.freebsd.org (Postfix) with ESMTP id 28E7D37B422 for ; Mon, 15 Apr 2002 14:10:02 -0700 (PDT) Received: (from gnats@localhost) by freefall.freebsd.org (8.11.6/8.11.6) id g3FLA2M65236; Mon, 15 Apr 2002 14:10:02 -0700 (PDT) (envelope-from gnats) Date: Mon, 15 Apr 2002 14:10:02 -0700 (PDT) Message-Id: <200204152110.g3FLA2M65236@freefall.freebsd.org> To: freebsd-bugs@FreeBSD.org Cc: From: Thomas Quinot Subject: Re: bin/37104 [PATCH] Reply-To: Thomas Quinot 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 The following reply was made to PR bin/37104; it has been noted by GNATS. From: Thomas Quinot To: bug-followup@freebsd.org Cc: Subject: Re: bin/37104 [PATCH] Date: Mon, 15 Apr 2002 23:04:29 +0200 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. --- 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) { Thomas. -- Thomas.Quinot@Cuivre.FR.EU.ORG To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-bugs" in the body of the message