From: Timo Teras <timo.teras@iki.fi>
To: musl@lists.openwall.com
Cc: u-igbb@aetey.se
Subject: Re: memmem() - is it correct?
Date: Wed, 9 Apr 2014 13:19:03 +0300 [thread overview]
Message-ID: <20140409131903.70876825@vostro> (raw)
In-Reply-To: <20140409100840.GD21662@example.net>
On Wed, 9 Apr 2014 12:08:40 +0200
u-igbb@aetey.se wrote:
> A test case adapted from elsewhere:
> ----
> #include <string.h>
>
> main(){
> const char *haystack = "abcde";
> return(!memmem(haystack, 4, "cde", 3));
> }
> ----
>
> returns 1 (as I would expect it to) if linked against uclibc
> returns 0 if linked against musl
> (on ia32)
>
> Any comments?
musl looks correct to me. "abcde" is five bytes. You test for 4 bytes
so it's infact searching from haystack equivalent of "abcd".
I'd say uclibc is off-by-one, and broken.
- Timo
next prev parent reply other threads:[~2014-04-09 10:19 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-04-09 10:08 u-igbb
2014-04-09 10:19 ` Timo Teras [this message]
[not found] ` <20140409104925.GE21662@example.net>
2014-04-09 12:51 ` Timo Teras
2014-04-09 12:54 ` Timo Teras
2014-04-10 1:15 ` Rich Felker
2014-04-09 12:14 u-igbb
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=20140409131903.70876825@vostro \
--to=timo.teras@iki.fi \
--cc=musl@lists.openwall.com \
--cc=u-igbb@aetey.se \
/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.
Code repositories for project(s) associated with this public inbox
https://git.vuxu.org/mirror/musl/
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).