Date: Mon, 15 Apr 2002 14:10:02 -0700 (PDT) From: Thomas Quinot <thomas@cuivre.fr.eu.org> To: freebsd-bugs@FreeBSD.org Subject: Re: bin/37104 [PATCH] Message-ID: <200204152110.g3FLA2M65236@freefall.freebsd.org>
next in thread | raw e-mail | index | archive | help
The following reply was made to PR bin/37104; it has been noted by GNATS. From: Thomas Quinot <thomas@cuivre.fr.eu.org> 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
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200204152110.g3FLA2M65236>