10 Aug 2009 14:06
Re: linux strlen man page accepts NULL?
Hello 2009/8/7 Michael Kerrisk <mtk.manpages@...>: > Jon, > > On Fri, Aug 7, 2009 at 1:55 PM, Jon Grant<jg@...> wrote: >> Looking at this man page: >> >> http://linux.die.net/man/3/strlen >> >> Should it not mention that a NULL address is a valid param? Or is it >> not a valid param? > > What makes you think it is a valid parameter? NULL points to 0x0, which could be mapped to something. On my embedded platform it is the beginning of the boot ROM. However typically 0x0 is an invalid address, in which case strlen should check for NULL, and return 0 e.g.: size_t strlen(const char *str) { const char *s; if(str == NULL) { return 0; }(Continue reading)
RSS Feed