From owner-freebsd-audit Mon Oct 9 11:17:59 2000 Delivered-To: freebsd-audit@freebsd.org Received: from rover.village.org (rover.village.org [204.144.255.49]) by hub.freebsd.org (Postfix) with ESMTP id 4BF6537B66C for ; Mon, 9 Oct 2000 11:17:51 -0700 (PDT) Received: from harmony.village.org (harmony.village.org [10.0.0.6]) by rover.village.org (8.11.0/8.11.0) with ESMTP id e99IHjY08861; Mon, 9 Oct 2000 12:17:45 -0600 (MDT) (envelope-from imp@harmony.village.org) Received: from harmony.village.org (localhost.village.org [127.0.0.1]) by harmony.village.org (8.9.3/8.8.3) with ESMTP id MAA13523; Mon, 9 Oct 2000 12:17:45 -0600 (MDT) Message-Id: <200010091817.MAA13523@harmony.village.org> To: Mike Heffner Subject: Re: mount_mfs (newfs) overflow fix Cc: FreeBSD-audit In-reply-to: Your message of "Mon, 09 Oct 2000 13:59:18 EDT." References: Date: Mon, 09 Oct 2000 12:17:44 -0600 From: Warner Losh Sender: owner-freebsd-audit@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG In message Mike Heffner writes: : Also fixes a potential uninitialized variable problem. Really? : --- newfs.c.orig Mon Oct 9 13:50:11 2000 : +++ newfs.c Mon Oct 9 13:37:10 2000 : @@ -167,7 +167,7 @@ : : #define NSECTORS 4096 /* number of sectors */ : : -int mfs; /* run as the memory based filesystem */ : +int mfs = 0; /* run as the memory based filesystem */ This is a null change. mfs already, per the C standard, is guaranteed to be initialized to 0. As it isn't an automatic variable, its initialization value is known. Adding the = 0 will increase the data segment by 4 bytes, which increases the file size by 4 bytes because initialized data is stored in the binary, while bss data isn't. : - (void)sprintf(device, "%s%s", _PATH_DEV, special); : + (void)snprintf(device, sizeof(device), "%s%s", _PATH_DEV, This almost certainly is harmless. However, it likely is a good change. Warner To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-audit" in the body of the message