Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP
Posting-Version: version B 2.10.2 9/18/84 +SENDMAIL+2.11; site dcl-cs.UUCP
Path: utzoo!watmath!clyde!bonnie!akgua!gatech!seismo!mcvax!ukc!dcl-cs!stephen
From: stephen@dcl-cs.UUCP (Stephen J. Muir)
Newsgroups: net.lang.c
Subject: Need strnlen().
Message-ID: <767@dcl-cs.UUCP>
Date: Thu, 7-Nov-85 17:14:07 EST
Article-I.D.: dcl-cs.767
Posted: Thu Nov  7 17:14:07 1985
Date-Received: Tue, 12-Nov-85 04:00:24 EST
Reply-To: stephen@comp.lancs.ac.uk (Stephen J. Muir)
Organization: Department of Computing at Lancaster University.
Lines: 17

I think that there should be a function called "strnlen" as follows:

int strnlen (string, size)
	char	*string;
	int	size;

where "size" is the maximum number of bytes in "string".

The reason is that, if a character array is passed as argument, and it is not
terminated with a null byte, then "strlen" will keep going, possibly hitting an
unallocated piece of memory.
-- 
UUCP:	...!seismo!mcvax!ukc!dcl-cs!stephen
DARPA:	stephen%comp.lancs.ac.uk@ucl-cs	| Post: University of Lancaster,
JANET:	stephen@uk.ac.lancs.comp	|	Department of Computing,
Phone:	+44 524 65201 Ext. 4599		|	Bailrigg, Lancaster, UK.
Project:Alvey ECLIPSE Distribution	|	LA1 4YR