From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.org/gmane.linux.lib.musl.general/4849 Path: news.gmane.org!not-for-mail From: Timo Teras Newsgroups: gmane.linux.lib.musl.general Subject: Re: memmem() - is it correct? Date: Wed, 9 Apr 2014 13:19:03 +0300 Message-ID: <20140409131903.70876825@vostro> References: <20140409100840.GD21662@example.net> Reply-To: musl@lists.openwall.com NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Trace: ger.gmane.org 1397038675 4702 80.91.229.3 (9 Apr 2014 10:17:55 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Wed, 9 Apr 2014 10:17:55 +0000 (UTC) Cc: u-igbb@aetey.se To: musl@lists.openwall.com Original-X-From: musl-return-4853-gllmg-musl=m.gmane.org@lists.openwall.com Wed Apr 09 12:17:49 2014 Return-path: Envelope-to: gllmg-musl@plane.gmane.org Original-Received: from mother.openwall.net ([195.42.179.200]) by plane.gmane.org with smtp (Exim 4.69) (envelope-from ) id 1WXpZh-0000xM-UW for gllmg-musl@plane.gmane.org; Wed, 09 Apr 2014 12:17:46 +0200 Original-Received: (qmail 3791 invoked by uid 550); 9 Apr 2014 10:17:45 -0000 Mailing-List: contact musl-help@lists.openwall.com; run by ezmlm Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: Original-Received: (qmail 3783 invoked from network); 9 Apr 2014 10:17:45 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:date:from:to:cc:subject:message-id:in-reply-to:references :mime-version:content-type:content-transfer-encoding; bh=g1IJB/EXavmgJjVxbkOkO02v/qqnHWSN8hEnK6ZauS8=; b=0KIk4k0L4zMYM8Vn12SLsFsGeK/oS+Fvhla1ACJ9TC37btsUNL3arzSnyJCp4Cw7RH ylBI9ZcWrSfYs4tjZ/JOuvv+qvs0xky1hfJnhuJsRXTkda/Rr7uRr4cuki6vbaJ0hJF8 BQEGZbxmKdDFTJSJAUh963/TUlFh+6h32/JczxIBWl9SOpzN3YwycP0rn3OjZhLDYAmx W/RT4/3oTH30KjoFZM9ORYbc/7WLcsHBUCcPxjGtVvbMwlDZ3Tv5DLeXPyzNu+3DMyh1 0TRiK73VGOSuiUsu41wzkWkS5Gp+ALaYe+mrVGnniUkgCcIvr7tukFtH3eXVoTG4V/4B q6uA== X-Received: by 10.152.3.72 with SMTP id a8mr6879608laa.33.1397038653829; Wed, 09 Apr 2014 03:17:33 -0700 (PDT) Original-Sender: =?UTF-8?Q?Timo_Ter=C3=A4s?= In-Reply-To: <20140409100840.GD21662@example.net> X-Mailer: Claws Mail 3.9.3 (GTK+ 2.24.23; i486-alpine-linux-uclibc) Xref: news.gmane.org gmane.linux.lib.musl.general:4849 Archived-At: On Wed, 9 Apr 2014 12:08:40 +0200 u-igbb@aetey.se wrote: > A test case adapted from elsewhere: > ---- > #include > > 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