Follow @Openwall on Twitter for new release announcements and other news
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Date: Wed, 9 Apr 2014 13:19:03 +0300
From: Timo Teras <timo.teras@....fi>
To: musl@...ts.openwall.com
Cc: u-igbb@...ey.se
Subject: Re: memmem() - is it correct?

On Wed, 9 Apr 2014 12:08:40 +0200
u-igbb@...ey.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

Powered by blists - more mailing lists

Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.