From owner-freebsd-hackers Sat Jan 11 11:54:27 1997 Return-Path: Received: (from root@localhost) by freefall.freebsd.org (8.8.4/8.8.4) id LAA01774 for hackers-outgoing; Sat, 11 Jan 1997 11:54:27 -0800 (PST) Received: from phaeton.artisoft.com (phaeton.Artisoft.COM [198.17.250.211]) by freefall.freebsd.org (8.8.4/8.8.4) with SMTP id LAA01768 for ; Sat, 11 Jan 1997 11:54:24 -0800 (PST) Received: (from terry@localhost) by phaeton.artisoft.com (8.6.11/8.6.9) id MAA24017; Sat, 11 Jan 1997 12:40:52 -0700 From: Terry Lambert Message-Id: <199701111940.MAA24017@phaeton.artisoft.com> Subject: Re: number of lines in a file, given its size To: joerg_wunsch@uriah.heep.sax.de Date: Sat, 11 Jan 1997 12:40:52 -0700 (MST) Cc: hackers@freebsd.org In-Reply-To: from "J Wunsch" at Jan 11, 97 01:20:23 pm X-Mailer: ELM [version 2.4 PL24] MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: owner-hackers@freebsd.org X-Loop: FreeBSD.org Precedence: bulk > > In line 115 in /usr/src/lib/libc/gen/getusershell.c: > > > > shells = calloc((unsigned)statb.st_size / 3, sizeof (char *)); > > ^^^^^^^^^^^^^^^^^ > > Isn't this a suspicious approximation of the number of lines in /etc/shells > > (just put `/' in it for example of an invalid entry). > > You are certainly right, but i think that's a moot point basically. > It requires you at least the following file in order to break: strdup() to the rescue! ... Terry Lambert terry@lambert.org --- Any opinions in this posting are my own and not those of my present or previous employers.