Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 11 Jan 1997 13:20:23 +0100
From:      j@uriah.heep.sax.de (J Wunsch)
To:        hackers@FreeBSD.org
Subject:   Re: number of lines in a file, given its size
Message-ID:  <Mutt.19970111132023.j@uriah.heep.sax.de>
In-Reply-To: <199701110202.DAA29018@xp11.frmug.org>; from Philippe Charnier on Jan 11, 1997 03:02:10 %2B0100
References:  <199701110202.DAA29018@xp11.frmug.org>

next in thread | previous in thread | raw e-mail | index | archive | help
As Philippe Charnier wrote:

> 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:

/bin/sh
/bin/csh
/
/
/
/

(Note, no comments allowed.)  Of course, this file is entirely bogus
anyway, and even adding a single character after the slash keeps it in
balance with that assumption.

Anyway, we appreciate your PR containing the correct fix. :-)

-- 
cheers, J"org

joerg_wunsch@uriah.heep.sax.de -- http://www.sax.de/~joerg/ -- NIC: JW11-RIPE
Never trust an operating system you don't have sources for. ;-)



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?Mutt.19970111132023.j>