diff options
Diffstat (limited to 'libc/bionic/__strrchr_chk.cpp')
-rw-r--r-- | libc/bionic/__strrchr_chk.cpp | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/libc/bionic/__strrchr_chk.cpp b/libc/bionic/__strrchr_chk.cpp index fe56c9ad2..4037207c2 100644 --- a/libc/bionic/__strrchr_chk.cpp +++ b/libc/bionic/__strrchr_chk.cpp @@ -31,17 +31,17 @@ #include <string.h> #include "private/libc_logging.h" -extern "C" char* __strrchr_chk(const char *p, int ch, size_t s_len) -{ - char *save; - - for (save = NULL;; ++p, s_len--) { - if (s_len == 0) - __fortify_chk_fail("strrchr prevented read past end of buffer", 0); - if (*p == (char) ch) - save = (char *)p; - if (!*p) - return(save); +extern "C" char* __strrchr_chk(const char *p, int ch, size_t s_len) { + for (char* save = NULL;; ++p, s_len--) { + if (s_len == 0) { + __fortify_chk_fail("strrchr: prevented read past end of buffer", 0); + } + if (*p == (char) ch) { + save = (char *)p; + } + if (!*p) { + return(save); } - /* NOTREACHED */ + } + /* NOTREACHED */ } |