Follow @Openwall on Twitter for new release announcements and other news
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Date: Sat, 26 May 2012 16:05:28 -0500
From: Richard Pennington <>
Subject: A small bug in strrchr


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)


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.