From owner-freebsd-ports Thu Jul 22 3:10:16 1999 Delivered-To: freebsd-ports@freebsd.org Received: from freefall.freebsd.org (freefall.FreeBSD.ORG [204.216.27.21]) by hub.freebsd.org (Postfix) with ESMTP id 419D7155EC for ; Thu, 22 Jul 1999 03:10:09 -0700 (PDT) (envelope-from gnats@FreeBSD.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.9.3/8.9.2) id DAA94248; Thu, 22 Jul 1999 03:10:02 -0700 (PDT) (envelope-from gnats@FreeBSD.org) Received: from pallas.veritas.com (pallas.veritas.com [204.177.156.25]) by hub.freebsd.org (Postfix) with ESMTP id 69AE8155E3 for ; Thu, 22 Jul 1999 03:09:07 -0700 (PDT) (envelope-from aaron@sigma.veritas.com) Received: from megami.veritas.com (megami.veritas.com [192.203.46.101]) by pallas.veritas.com (8.9.1a/8.9.1) with SMTP id DAA29941; Thu, 22 Jul 1999 03:10:13 -0700 (PDT) Received: from sigma.veritas.com([192.203.46.125]) (1743 bytes) by megami.veritas.com via sendmail with P:esmtp/R:smart_host/T:smtp (sender: ) id for ; Thu, 22 Jul 1999 03:09:06 -0700 (PDT) (Smail-3.2.0.101 1997-Dec-17 #3 built 1999-Jan-25) Received: from sigma (localhost [127.0.0.1]) by sigma.veritas.com (8.9.2/8.9.1) with ESMTP id DAA12862; Thu, 22 Jul 1999 03:09:05 -0700 (PDT) (envelope-from aaron@sigma.veritas.com) Message-Id: <199907221009.DAA12862@sigma.veritas.com> Date: Thu, 22 Jul 1999 03:09:05 -0700 From: aaron@mutex.org Reply-To: aaron@mutex.org To: FreeBSD-gnats-submit@freebsd.org Cc: aaron@mutex.org X-Send-Pr-Version: 3.2 Subject: ports/12761: sysutils/stat fails to properly terminate buffer and can print garbage Sender: owner-freebsd-ports@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.org >Number: 12761 >Category: ports >Synopsis: sysutils/stat doesn't terminate buffer and can print garbage >Confidential: no >Severity: non-critical >Priority: medium >Responsible: freebsd-ports >State: open >Quarter: >Keywords: >Date-Required: >Class: sw-bug >Submitter-Id: current-users >Arrival-Date: Thu Jul 22 03:10:02 PDT 1999 >Closed-Date: >Last-Modified: >Originator: Aaron Smith >Release: FreeBSD 3.2-RELEASE i386 >Organization: Mutant X >Environment: stat-1.3 Print inode contents >Description: the FmtInode function in stat.fmt.c does not properly null terminate its result in the supplied buffer. this can result in garbage characters and errors. >How-To-Repeat: either put a memset in stat_it or change malloc.conf so that the buffer is explicitly nonzero, and try running stat against a few different files. you should see a garbage char on the final (supposed to be blank) line. >Fix: the following patch makes FmtInode terminate its result. --- stat.fmt.c.orig Sun Feb 16 05:12:33 1997 +++ stat.fmt.c Wed Jul 14 17:20:36 1999 @@ -500,6 +500,7 @@ } } } + *bufp++ = '\0'; } /* ** USAGE -- Display a reminder >Release-Note: >Audit-Trail: >Unformatted: To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-ports" in the body of the message