Re: linux strlen man page accepts NULL?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Saturday 19 September 2009 22:41:41 Michael Kerrisk wrote:
> On Mon, Aug 10, 2009 at 2:06 PM, Jon Grant wrote:
> > 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
> 
> I don't think it should check for this. If the addres is invalid, it
> should be treated like any other invalid address -- usually a SIGSEGV
> results.

right.  if 0 is a valid address, then strlen() should work.  if it isnt valid 
and you called strlen() on it anyways, then your code sucks and it should 
crash.  POSIX does not require special handling of any address, so neither 
should Linux.
-mike

Attachment: signature.asc
Description: This is a digitally signed message part.


[Index of Archives]     [Kernel Documentation]     [Netdev]     [Linux Ethernet Bridging]     [Linux Wireless]     [Kernel Newbies]     [Security]     [Linux for Hams]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux Admin]     [Samba]

  Powered by Linux