Date: Mon, 09 Oct 2000 12:17:44 -0600 From: Warner Losh <imp@village.org> To: Mike Heffner <mheffner@vt.edu> Cc: FreeBSD-audit <FreeBSD-audit@FreeBSD.ORG> Subject: Re: mount_mfs (newfs) overflow fix Message-ID: <200010091817.MAA13523@harmony.village.org> In-Reply-To: Your message of "Mon, 09 Oct 2000 13:59:18 EDT." <XFMail.20001009135918.mheffner@vt.edu> References: <XFMail.20001009135918.mheffner@vt.edu>
next in thread | previous in thread | raw e-mail | index | archive | help
In message <XFMail.20001009135918.mheffner@vt.edu> 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
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200010091817.MAA13523>