[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Bug-gnulib] strnstr
From: |
Paul Eggert |
Subject: |
Re: [Bug-gnulib] strnstr |
Date: |
Wed, 29 Sep 2004 15:32:11 -0700 |
User-agent: |
Gnus/5.1006 (Gnus v5.10.6) Emacs/21.3 (gnu/linux) |
Bruno Haible <address@hidden> writes:
> Simon Josefsson wrote:
>> Darwin and FreeBSD has this, and GnuTLS is using it.
>
> Hmm. FreeBSD has some str'n' functions that work on truncated strings,
> i.e. it always uses MIN (strlen(s), N) as actual length. This seems
> like a broken concept to me, because
> - it is slower than just using strlen(s) or N as actual length,
> - it provides the illusion of being safe, but isn't because it will
> silently truncate strings, thus producing garbage effects at will,
> - the common GNU concept is to allocate strings that are as long as
> they need to be.
I agree pretty much on all these points. The strn* stuff is
antithetical to the usual GNU style.
It may be worth mentioning that this has been a bone of contention
between the GNU/Linux folks and some of the BSD folks for quite some time.
See, for example, the thread starting here:
Linus Torvalds
Re: [open-source] Re: Wish for 2002 ...
2002-01-21
<http://lists.nas.nasa.gov/archives/ext/linux-security-audit/2002/01/msg00073.html>
If you have the patience to wade through that thread, you'll see why I
think Linus is right and Theo de Raadt is wrong about the strn*
functions. (You'll also see Theo dismissing my arguments with the
comment "WHat an utter waste of timje." [sic] :-)
- [Bug-gnulib] strnstr, Simon Josefsson, 2004/09/29
- Re: [Bug-gnulib] strnstr, Bruno Haible, 2004/09/29
- Re: [Bug-gnulib] strnstr,
Paul Eggert <=
- [Bug-gnulib] Re: strnstr, Simon Josefsson, 2004/09/29
- [Bug-gnulib] memstr (was: Re: strnstr), Simon Josefsson, 2004/09/30
- Re: [Bug-gnulib] memstr, Paul Eggert, 2004/09/30
- [Bug-gnulib] Re: memstr, Simon Josefsson, 2004/09/30
- Re: [Bug-gnulib] Re: memstr, Paul Eggert, 2004/09/30