Date: Wed, 12 Feb 1997 18:04:59 +1100 (EST) From: "Daniel O'Callaghan" <danny@panda.hilink.com.au> To: hackers@freebsd.org Subject: strlen() question Message-ID: <Pine.BSF.3.91.970212175317.427s-100000@panda.hilink.com.au>
next in thread | raw e-mail | index | archive | help
Below is the code for strlen() from libc. It is extremely simple, and fast. Is it really safe to assume that strlen() will never exceed process memory bounds before striking a '\0'? Or should there be a strnlen() function in libc for checking the length of suspicious strings? Danny size_t strlen(str) const char *str; { register const char *s; for (s = str; *s; ++s); return(s - str); }
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?Pine.BSF.3.91.970212175317.427s-100000>