Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!mnetor!seismo!uwvax!cottage!lm From: lm@cottage.WISC.EDU (Larry McVoy) Newsgroups: comp.os.minix Subject: Re: Bug in library routine getenv() Message-ID: <3569@spool.WISC.EDU> Date: Tue, 12-May-87 14:03:34 EDT Article-I.D.: spool.3569 Posted: Tue May 12 14:03:34 1987 Date-Received: Fri, 15-May-87 01:03:27 EDT References: <3860@cae780.TEK.COM> <868@mimir.dmt.oz> <2494@ncoast.UUCP> Sender: news@spool.WISC.EDU Reply-To: lm@cottage.WISC.EDU (Larry McVoy) Organization: U of Wisconsin CS Dept Lines: 22 (Brandon Allbery) claims: >| > I believe there is also a bug in the >| > library routine strncpy -- it doesn't null terminate the string >>> if the string >| > to copy is really longer that "n" characters. > >I can see where he would get confised, though; System V documents it as >*always* null-terminating the string. No idea how V7 does it. System III >and Xenix don't say one way or the other. > >++Brando I quote from the System V Interface Definition "The function strncpy copies exactly n characters... The result will not be null terminated if the length of s2 is n or more." Brandon, please don't spread ignorance. I don't think you realize how many people are going to assume that you are right and then find out you were wrong when their code bombs. Check your facts or clause them. Larry McVoy lm@cottage.wisc.edu or uwvax!mcvoy