From owner-freebsd-security Sat Jun 26 14:54:14 1999 Delivered-To: freebsd-security@freebsd.org Received: from alice.gba.oz.au (gba-254.tmx.com.au [203.9.155.254]) by hub.freebsd.org (Postfix) with SMTP id 453D3151B0 for ; Sat, 26 Jun 1999 14:54:05 -0700 (PDT) (envelope-from gjb-freebsd@gba.oz.au) Received: (qmail 7900 invoked by uid 1001); 27 Jun 1999 07:34:26 +1000 Message-ID: <19990626213426.7899.qmail@alice.gba.oz.au> X-Posted-By: GBA-Post 1.03 20-Sep-1998 X-PGP-Fingerprint: 5A91 6942 8CEA 9DAB B95B C249 1CE1 493B 2B5A CE30 Date: Sun, 27 Jun 1999 07:34:25 +1000 From: Greg Black To: Wes Peters Cc: cjclark@home.com, FreeBSD Security Subject: Re: Secure Deletion References: <199906250212.WAA07810@cc942873-a.ewndsr1.nj.home.com> <3773F67A.CC9B6215@softweyr.com> In-reply-to: <3773F67A.CC9B6215@softweyr.com> of Fri, 25 Jun 1999 15:36:58 CST Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Sender: owner-freebsd-security@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.org Wes Peters writes: > * Obliterate - a simple program to obliterate file contents. I note that the error in the posted program with the size of the overwrite bit patterns was addressed in a follow-up. However, there is another issue that makes it a "bad" program: > void > obliterate(char *fname) [...] > int > main(int argc, char *argv[]) > { > while (--argc) > { > obliterate(argv[argc]); > } > > return 0; > } Given that there is a bunch of error conditions that are checked for and which may cause the program to abort, surely making it report success on exit, regardless of what actually happened, is a Bad Thing? It would be trivial to make obliterate() return an int (e.g., 1 for an error and 0 for success). This would then give us a main() like this (with a refinement to process the arguments in the order given rather than backwards, because I don't like to surprise people): int main(int argc, char **argv) { int status = 0; while (--argc) status |= obliterate(*++argv); return status; } Disclaimer: I haven't compiled or tested the program and I have not reviewed it thoroughly. These comments are from a cursory read. -- Greg Black -- or Fight censorship in Australia: To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-security" in the body of the message