From: Richard Pennington <rich@pennware.com>
To: musl@lists.openwall.com
Subject: A small bug in strrchr
Date: Sat, 26 May 2012 16:05:28 -0500 [thread overview]
Message-ID: <11455510.kDygYk5USg@main.pennware.com> (raw)
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 <string.h>
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
next reply other threads:[~2012-05-26 21:05 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-05-26 21:05 Richard Pennington [this message]
2012-05-26 22:06 ` Rich Felker
2012-05-26 22:12 ` Richard Pennington
2012-05-26 22:40 ` Szabolcs Nagy
2012-05-26 22:50 ` Richard Pennington
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=11455510.kDygYk5USg@main.pennware.com \
--to=rich@pennware.com \
--cc=musl@lists.openwall.com \
/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).