Need strnlen().
Mike Shannon
mikes at 3comvax.UUCP
Fri Nov 15 03:42:03 AEST 1985
Stephen Muir in the cited article:
> 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.
Then write one! Geez!!
--
Michael Shannon {ihnp4,hplabs}!oliveb!3comvax!mikes
More information about the Comp.lang.c
mailing list