Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 27 May 2003 11:31:39 +0300
From:      Peter Pentchev <roam@ringlet.net>
To:        Seva Gluschenko <gvs@rinet.ru>
Cc:        Dag-Erling Smorgrav <des@FreeBSD.org>
Subject:   Re: bin/52691: str[n][case]cmp may cause segmentation violationwith NULL pointers passed
Message-ID:  <20030527083139.GA513@straylight.oblivion.bg>
In-Reply-To: <20030527121942.W33922@road.demos.su>
References:  <200305262053.h4QKr3GB026031@freefall.freebsd.org> <20030527121942.W33922@road.demos.su>

next in thread | previous in thread | raw e-mail | index | archive | help

--k+w/mQv8wyuph6w0
Content-Type: text/plain; charset=windows-1251
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

On Tue, May 27, 2003 at 12:20:37PM +0400, Seva Gluschenko wrote:
> Message of Dag-Erling Smorgrav at May 26 13:53 ...
>=20
> DS> Synopsis: str[n][case]cmp may cause segmentation violation with NULL =
pointers passed
> DS>
> DS> State-Changed-From-To: open->closed
> DS> State-Changed-By: des
> DS> State-Changed-When: Mon May 26 13:53:02 PDT 2003
> DS> State-Changed-Why:
> DS> The bug is in the application that passes NULL to strcmp.
>=20
> Well, sir, can you please quote me some ISO C89 or another standard
> which allows str*cmp not to care about NULL pointers?

I think that in this case, the burden just might be on the programmer;
with all due respect, could you quote any part of the standard that
specifies that str[n]cmp behaves in a special way about NULL pointers?
In my experience, such behavior is usually explicitly documented, such
as the EBADF or EINVAL error returns from select(2), under an 'ERRORS'
or similar section of the standard.  The SUSv3 description of
strncmp(3), available online for a free registration at
http://www.unix-systems.org/single_unix_specification/, does not seem to
mention NULL pointers or error conditions anywhere, except for the 'no
errors are defined' sentence in the 'ERRORS' section.

G'luck,
Peter

--=20
Peter Pentchev	roam@ringlet.net    roam@sbnd.net    roam@FreeBSD.org
PGP key:	http://people.FreeBSD.org/~roam/roam.key.asc
Key fingerprint	FDBA FD79 C26F 3C51 C95E  DF9E ED18 B68D 1619 4553
Hey, out there - is it *you* reading me, or is it someone else?

--k+w/mQv8wyuph6w0
Content-Type: application/pgp-signature
Content-Disposition: inline

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.2 (FreeBSD)

iD8DBQE+0yJq7Ri2jRYZRVMRAhBqAKCHbmgf8JHDIj39JwVahjfnvaKlAwCdEMFo
y5CTpFSqWZNPOsIpisLoAK0=
=Qnay
-----END PGP SIGNATURE-----

--k+w/mQv8wyuph6w0--



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20030527083139.GA513>