public inbox for linux-man@vger.kernel.org
 help / color / mirror / Atom feed
From: Mike Frysinger <vapier-aBrp7R+bbdUdnm+yROfE0A@public.gmane.org>
To: mtk.manpages-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org
Cc: Jon Grant <jg-hus3n9K41k0@public.gmane.org>,
	linux-man-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
Subject: Re: linux strlen man page accepts NULL?
Date: Tue, 22 Sep 2009 02:43:28 -0400	[thread overview]
Message-ID: <200909220243.30006.vapier@gentoo.org> (raw)
In-Reply-To: <cfd18e0f0909191941s421596b1ne08da9906f4e4d5d-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>

[-- Attachment #1: Type: Text/Plain, Size: 717 bytes --]

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 #2: This is a digitally signed message part. --]
[-- Type: application/pgp-signature, Size: 836 bytes --]

      parent reply	other threads:[~2009-09-22  6:43 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-08-07 11:55 linux strlen man page accepts NULL? Jon Grant
     [not found] ` <19ac3f7a0908070455s33ecb5efo6810eb7959df1f70-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2009-08-07 19:51   ` Michael Kerrisk
     [not found]     ` <cfd18e0f0908071251h27d2d7d6o4c7d8ae2a4c1913f-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2009-08-10 12:06       ` Jon Grant
     [not found]         ` <19ac3f7a0908100506j7ec9933gec944f3b5bb92ef0-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2009-09-20  2:41           ` Michael Kerrisk
     [not found]             ` <cfd18e0f0909191941s421596b1ne08da9906f4e4d5d-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2009-09-22  6:43               ` Mike Frysinger [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=200909220243.30006.vapier@gentoo.org \
    --to=vapier-abrp7r+bbdudnm+yrofe0a@public.gmane.org \
    --cc=jg-hus3n9K41k0@public.gmane.org \
    --cc=linux-man-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=mtk.manpages-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox