diff --git a/libs/libc/src/string.cpp b/libs/libc/src/string.cpp index dff7c8e2..958182d7 100644 --- a/libs/libc/src/string.cpp +++ b/libs/libc/src/string.cpp @@ -136,8 +136,9 @@ extern "C" char* strrchr(const char* str, int c) { const char* s = str + strlen(str); - while (s != str && *str != (char)c) str--; + while (s != str && *s != (char)c) s--; if (s != str) return const_cast(s); + if (*s == (char)c) return const_cast(s); return NULL; }