From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.org/gmane.linux.lib.musl.general/922 Path: news.gmane.org!not-for-mail From: Richard Pennington Newsgroups: gmane.linux.lib.musl.general Subject: A small bug in strrchr Date: Sat, 26 May 2012 16:05:28 -0500 Message-ID: <11455510.kDygYk5USg@main.pennware.com> 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: dough.gmane.org 1338066403 12537 80.91.229.3 (26 May 2012 21:06:43 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Sat, 26 May 2012 21:06:43 +0000 (UTC) To: musl@lists.openwall.com Original-X-From: musl-return-923-gllmg-musl=m.gmane.org@lists.openwall.com Sat May 26 23:06:43 2012 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 1SYOC9-0003iz-P9 for gllmg-musl@plane.gmane.org; Sat, 26 May 2012 23:06:41 +0200 Original-Received: (qmail 11373 invoked by uid 550); 26 May 2012 21:06:40 -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 11363 invoked from network); 26 May 2012 21:06:40 -0000 X-Authority-Analysis: v=2.0 cv=PqgRnnw3 c=1 sm=0 a=/l7PkcR/UKDnn7Q2wmGJww==:17 a=hdNgKtvFP3AA:10 a=fR_ARpL9IlcA:10 a=msTO8fkKGJEA:10 a=kj9zAlcOel0A:10 a=N4Ps669bAAAA:8 a=CQFbJzmE7f9GxI9PlOIA:9 a=CjuIK1q_8ugA:10 a=/l7PkcR/UKDnn7Q2wmGJww==:117 X-Cloudmark-Score: 0 X-Originating-IP: 65.26.59.215 User-Agent: KMail/4.8.3 (Linux/3.3.2-6.fc16.x86_64; KDE/4.8.3; x86_64; ; ) Xref: news.gmane.org gmane.linux.lib.musl.general:922 Archived-At: Hi, I found a small bug in strrchr(). strrchr("string", '\0') does not return a pointer to the trailing nul byte. Here is the corrected version: #include void *__memrchr(const void *, int, size_t); char *strrchr(const char *s, int c) { return __memrchr(s, c, strlen(s) + 1); } (I added the + 1) -Rich