blob: 6f0ee4ae7b7763d8b92b88da3773db8f776b3dd1 [file] [log] [blame]
George Burgess IVb97049c2017-07-24 15:05:05 -07001/*
2 * Copyright (C) 2017 The Android Open Source Project
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above copyright
11 * notice, this list of conditions and the following disclaimer in
12 * the documentation and/or other materials provided with the
13 * distribution.
14 *
15 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
16 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
17 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
18 * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
19 * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
20 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
21 * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
22 * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
23 * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
24 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
25 * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
26 * SUCH DAMAGE.
27 */
28
29#ifndef _STRING_H
30#error "Never include this file directly; instead, include <string.h>"
31#endif
32
Dan Albert02ce4012024-10-25 19:13:49 +000033
34#if __BIONIC_AVAILABILITY_GUARD(23)
zijunzhao6d23a082023-06-09 21:34:24 +000035void* _Nullable __memchr_chk(const void* _Nonnull, int, size_t, size_t) __INTRODUCED_IN(23);
36void* _Nullable __memrchr_chk(const void* _Nonnull, int, size_t, size_t) __INTRODUCED_IN(23);
Dan Albert02ce4012024-10-25 19:13:49 +000037#endif /* __BIONIC_AVAILABILITY_GUARD(23) */
38
Elliott Hughes655e4302023-06-16 12:39:33 -070039char* _Nonnull __stpncpy_chk2(char* _Nonnull, const char* _Nonnull, size_t, size_t, size_t);
40char* _Nonnull __strncpy_chk2(char* _Nonnull, const char* _Nonnull, size_t, size_t, size_t);
41size_t __strlcpy_chk(char* _Nonnull, const char* _Nonnull, size_t, size_t);
42size_t __strlcat_chk(char* _Nonnull, const char* _Nonnull, size_t, size_t);
George Burgess IVb97049c2017-07-24 15:05:05 -070043
George Burgess IVb97049c2017-07-24 15:05:05 -070044#if defined(__BIONIC_FORTIFY)
Elliott Hugheseb8785a2024-08-28 13:15:48 +000045void* _Nullable __memrchr_real(const void* _Nonnull, int, size_t) __RENAME(memrchr);
Elliott Hughesdf9a4892017-08-23 14:34:03 -070046
Elliott Hughesf4ace9d2023-02-23 17:38:37 +000047#if __BIONIC_FORTIFY_RUNTIME_CHECKS_ENABLED
George Burgess IV36926f42019-09-15 16:57:00 -070048/* No diag -- clang diagnoses misuses of this on its own. */
George Burgess IVb97049c2017-07-24 15:05:05 -070049__BIONIC_FORTIFY_INLINE
zijunzhao6d23a082023-06-09 21:34:24 +000050void* _Nonnull memcpy(void* _Nonnull const dst __pass_object_size0, const void* _Nonnull src, size_t copy_amount)
Pirama Arumuga Nainardb71def2022-01-06 15:46:55 -080051 __diagnose_as_builtin(__builtin_memcpy, 1, 2, 3)
George Burgess IV36926f42019-09-15 16:57:00 -070052 __overloadable {
George Burgess IV2f787652020-02-04 21:40:40 -080053 return __builtin___memcpy_chk(dst, src, copy_amount, __bos0(dst));
George Burgess IVb97049c2017-07-24 15:05:05 -070054}
55
George Burgess IV36926f42019-09-15 16:57:00 -070056/* No diag -- clang diagnoses misuses of this on its own. */
George Burgess IVb97049c2017-07-24 15:05:05 -070057__BIONIC_FORTIFY_INLINE
zijunzhao6d23a082023-06-09 21:34:24 +000058void* _Nonnull memmove(void* _Nonnull const dst __pass_object_size0, const void* _Nonnull src, size_t len)
Pirama Arumuga Nainardb71def2022-01-06 15:46:55 -080059 __diagnose_as_builtin(__builtin_memmove, 1, 2, 3)
60 __overloadable {
George Burgess IV2f787652020-02-04 21:40:40 -080061 return __builtin___memmove_chk(dst, src, len, __bos0(dst));
George Burgess IVb97049c2017-07-24 15:05:05 -070062}
George Burgess IV8a0cdb12019-10-21 13:27:57 -070063#endif
George Burgess IVb97049c2017-07-24 15:05:05 -070064
George Burgess IV849c0b92019-06-10 16:22:09 -070065#if defined(__USE_GNU)
Elliott Hughes95c6cd72019-12-20 13:26:14 -080066#if __ANDROID_API__ >= 30
George Burgess IV849c0b92019-06-10 16:22:09 -070067__BIONIC_FORTIFY_INLINE
zijunzhao6d23a082023-06-09 21:34:24 +000068void* _Nonnull mempcpy(void* _Nonnull const dst __pass_object_size0, const void* _Nonnull src, size_t copy_amount)
Pirama Arumuga Nainardb71def2022-01-06 15:46:55 -080069 __diagnose_as_builtin(__builtin_mempcpy, 1, 2, 3)
George Burgess IV849c0b92019-06-10 16:22:09 -070070 __overloadable
71 __clang_error_if(__bos_unevaluated_lt(__bos0(dst), copy_amount),
72 "'mempcpy' called with size bigger than buffer") {
George Burgess IV8a0cdb12019-10-21 13:27:57 -070073#if __BIONIC_FORTIFY_RUNTIME_CHECKS_ENABLED
George Burgess IV849c0b92019-06-10 16:22:09 -070074 size_t bos_dst = __bos0(dst);
George Burgess IV8a0cdb12019-10-21 13:27:57 -070075 if (!__bos_trivially_ge(bos_dst, copy_amount)) {
76 return __builtin___mempcpy_chk(dst, src, copy_amount, bos_dst);
George Burgess IV849c0b92019-06-10 16:22:09 -070077 }
George Burgess IV8a0cdb12019-10-21 13:27:57 -070078#endif
79 return __builtin_mempcpy(dst, src, copy_amount);
George Burgess IV849c0b92019-06-10 16:22:09 -070080}
Elliott Hughes95c6cd72019-12-20 13:26:14 -080081#endif /* __ANDROID_API__ >= 30 */
George Burgess IVfd1ff4b2019-09-18 17:29:55 -070082#endif /* __USE_GNU */
George Burgess IV849c0b92019-06-10 16:22:09 -070083
George Burgess IVb97049c2017-07-24 15:05:05 -070084__BIONIC_FORTIFY_INLINE
zijunzhao6d23a082023-06-09 21:34:24 +000085char* _Nonnull stpcpy(char* _Nonnull const dst __pass_object_size, const char* _Nonnull src)
George Burgess IVb6300462017-07-31 21:29:42 -070086 __overloadable
George Burgess IVc03d5962019-05-23 15:22:01 -070087 __clang_error_if(__bos_unevaluated_le(__bos(dst), __builtin_strlen(src)),
George Burgess IVb6300462017-07-31 21:29:42 -070088 "'stpcpy' called with string bigger than buffer") {
Elliott Hughesf4ace9d2023-02-23 17:38:37 +000089#if __BIONIC_FORTIFY_RUNTIME_CHECKS_ENABLED
George Burgess IV2f787652020-02-04 21:40:40 -080090 return __builtin___stpcpy_chk(dst, src, __bos(dst));
91#else
George Burgess IVfd1ff4b2019-09-18 17:29:55 -070092 return __builtin_stpcpy(dst, src);
George Burgess IV2f787652020-02-04 21:40:40 -080093#endif
George Burgess IVfd1ff4b2019-09-18 17:29:55 -070094}
George Burgess IVb97049c2017-07-24 15:05:05 -070095
George Burgess IVb97049c2017-07-24 15:05:05 -070096__BIONIC_FORTIFY_INLINE
zijunzhao6d23a082023-06-09 21:34:24 +000097char* _Nonnull strcpy(char* _Nonnull const dst __pass_object_size, const char* _Nonnull src)
Pirama Arumuga Nainardb71def2022-01-06 15:46:55 -080098 __diagnose_as_builtin(__builtin_strcpy, 1, 2)
George Burgess IVb6300462017-07-31 21:29:42 -070099 __overloadable
George Burgess IVc03d5962019-05-23 15:22:01 -0700100 __clang_error_if(__bos_unevaluated_le(__bos(dst), __builtin_strlen(src)),
George Burgess IVb6300462017-07-31 21:29:42 -0700101 "'strcpy' called with string bigger than buffer") {
Elliott Hughesf4ace9d2023-02-23 17:38:37 +0000102#if __BIONIC_FORTIFY_RUNTIME_CHECKS_ENABLED
George Burgess IV2f787652020-02-04 21:40:40 -0800103 return __builtin___strcpy_chk(dst, src, __bos(dst));
104#else
George Burgess IVfd1ff4b2019-09-18 17:29:55 -0700105 return __builtin_strcpy(dst, src);
George Burgess IV2f787652020-02-04 21:40:40 -0800106#endif
George Burgess IVb97049c2017-07-24 15:05:05 -0700107}
108
109__BIONIC_FORTIFY_INLINE
zijunzhao6d23a082023-06-09 21:34:24 +0000110char* _Nonnull strcat(char* _Nonnull const dst __pass_object_size, const char* _Nonnull src)
George Burgess IV77f99aa2019-06-06 14:14:52 -0700111 __overloadable
112 __clang_error_if(__bos_unevaluated_le(__bos(dst), __builtin_strlen(src)),
113 "'strcat' called with string bigger than buffer") {
Elliott Hughesf4ace9d2023-02-23 17:38:37 +0000114#if __BIONIC_FORTIFY_RUNTIME_CHECKS_ENABLED
George Burgess IVb97049c2017-07-24 15:05:05 -0700115 return __builtin___strcat_chk(dst, src, __bos(dst));
George Burgess IVfd1ff4b2019-09-18 17:29:55 -0700116#else
117 return __builtin_strcat(dst, src);
George Burgess IV8a0cdb12019-10-21 13:27:57 -0700118#endif
George Burgess IVb97049c2017-07-24 15:05:05 -0700119}
120
Elliott Hughesf4ace9d2023-02-23 17:38:37 +0000121#if __BIONIC_FORTIFY_RUNTIME_CHECKS_ENABLED
George Burgess IV36926f42019-09-15 16:57:00 -0700122/* No diag -- clang diagnoses misuses of this on its own. */
George Burgess IVb97049c2017-07-24 15:05:05 -0700123__BIONIC_FORTIFY_INLINE
zijunzhao6d23a082023-06-09 21:34:24 +0000124char* _Nonnull strncat(char* _Nonnull const dst __pass_object_size, const char* _Nonnull src, size_t n)
Pirama Arumuga Nainardb71def2022-01-06 15:46:55 -0800125 __diagnose_as_builtin(__builtin_strncat, 1, 2, 3)
126 __overloadable {
George Burgess IVb97049c2017-07-24 15:05:05 -0700127 return __builtin___strncat_chk(dst, src, n, __bos(dst));
128}
George Burgess IV8a0cdb12019-10-21 13:27:57 -0700129#endif
George Burgess IVb97049c2017-07-24 15:05:05 -0700130
George Burgess IV36926f42019-09-15 16:57:00 -0700131/* No diag -- clang diagnoses misuses of this on its own. */
George Burgess IVb97049c2017-07-24 15:05:05 -0700132__BIONIC_FORTIFY_INLINE
zijunzhao6d23a082023-06-09 21:34:24 +0000133void* _Nonnull memset(void* _Nonnull const s __pass_object_size0, int c, size_t n) __overloadable
Pirama Arumuga Nainardb71def2022-01-06 15:46:55 -0800134 __diagnose_as_builtin(__builtin_memset, 1, 2, 3)
George Burgess IVb6300462017-07-31 21:29:42 -0700135 /* If you're a user who wants this warning to go away: use `(&memset)(foo, bar, baz)`. */
136 __clang_warning_if(c && !n, "'memset' will set 0 bytes; maybe the arguments got flipped?") {
Elliott Hughesf4ace9d2023-02-23 17:38:37 +0000137#if __BIONIC_FORTIFY_RUNTIME_CHECKS_ENABLED
George Burgess IV2f787652020-02-04 21:40:40 -0800138 return __builtin___memset_chk(s, c, n, __bos0(s));
139#else
George Burgess IVfd1ff4b2019-09-18 17:29:55 -0700140 return __builtin_memset(s, c, n);
George Burgess IV2f787652020-02-04 21:40:40 -0800141#endif
George Burgess IVfd1ff4b2019-09-18 17:29:55 -0700142}
George Burgess IVb97049c2017-07-24 15:05:05 -0700143
Elliott Hughes95c6cd72019-12-20 13:26:14 -0800144#if __ANDROID_API__ >= 23 && __BIONIC_FORTIFY_RUNTIME_CHECKS_ENABLED
George Burgess IVb97049c2017-07-24 15:05:05 -0700145__BIONIC_FORTIFY_INLINE
zijunzhao6d23a082023-06-09 21:34:24 +0000146void* _Nullable memchr(const void* _Nonnull const s __pass_object_size, int c, size_t n) __overloadable {
George Burgess IVb97049c2017-07-24 15:05:05 -0700147 size_t bos = __bos(s);
148
George Burgess IVc03d5962019-05-23 15:22:01 -0700149 if (__bos_trivially_ge(bos, n)) {
George Burgess IVb97049c2017-07-24 15:05:05 -0700150 return __builtin_memchr(s, c, n);
151 }
152
153 return __memchr_chk(s, c, n, bos);
154}
155
156__BIONIC_FORTIFY_INLINE
zijunzhao6d23a082023-06-09 21:34:24 +0000157void* _Nullable __memrchr_fortify(const void* _Nonnull const __pass_object_size s, int c, size_t n) __overloadable {
George Burgess IVb97049c2017-07-24 15:05:05 -0700158 size_t bos = __bos(s);
159
George Burgess IVc03d5962019-05-23 15:22:01 -0700160 if (__bos_trivially_ge(bos, n)) {
Elliott Hughesdf9a4892017-08-23 14:34:03 -0700161 return __memrchr_real(s, c, n);
George Burgess IVb97049c2017-07-24 15:05:05 -0700162 }
163
164 return __memrchr_chk(s, c, n, bos);
165}
George Burgess IV8a0cdb12019-10-21 13:27:57 -0700166#endif
George Burgess IVb97049c2017-07-24 15:05:05 -0700167
Elliott Hughesf4ace9d2023-02-23 17:38:37 +0000168#if __BIONIC_FORTIFY_RUNTIME_CHECKS_ENABLED
George Burgess IV36926f42019-09-15 16:57:00 -0700169/* No diag -- clang diagnoses misuses of this on its own. */
George Burgess IVb97049c2017-07-24 15:05:05 -0700170__BIONIC_FORTIFY_INLINE
zijunzhao6d23a082023-06-09 21:34:24 +0000171char* _Nonnull stpncpy(char* _Nonnull const dst __pass_object_size, const char* _Nonnull const src __pass_object_size, size_t n)
Pirama Arumuga Nainardb71def2022-01-06 15:46:55 -0800172 __diagnose_as_builtin(__builtin_stpncpy, 1, 2, 3)
George Burgess IV36926f42019-09-15 16:57:00 -0700173 __overloadable {
George Burgess IVb97049c2017-07-24 15:05:05 -0700174 size_t bos_dst = __bos(dst);
175 size_t bos_src = __bos(src);
176
177 /* Ignore dst size checks; they're handled in strncpy_chk */
178 if (bos_src == __BIONIC_FORTIFY_UNKNOWN_SIZE) {
179 return __builtin___stpncpy_chk(dst, src, n, bos_dst);
180 }
181
182 return __stpncpy_chk2(dst, src, n, bos_dst, bos_src);
183}
184
George Burgess IV36926f42019-09-15 16:57:00 -0700185/* No diag -- clang diagnoses misuses of this on its own. */
George Burgess IVb97049c2017-07-24 15:05:05 -0700186__BIONIC_FORTIFY_INLINE
zijunzhao6d23a082023-06-09 21:34:24 +0000187char* _Nonnull strncpy(char* _Nonnull const dst __pass_object_size, const char* _Nonnull const src __pass_object_size, size_t n)
Pirama Arumuga Nainardb71def2022-01-06 15:46:55 -0800188 __diagnose_as_builtin(__builtin_strncpy, 1, 2, 3)
George Burgess IV36926f42019-09-15 16:57:00 -0700189 __overloadable {
George Burgess IVb97049c2017-07-24 15:05:05 -0700190 size_t bos_dst = __bos(dst);
191 size_t bos_src = __bos(src);
192
193 /* Ignore dst size checks; they're handled in strncpy_chk */
194 if (bos_src == __BIONIC_FORTIFY_UNKNOWN_SIZE) {
195 return __builtin___strncpy_chk(dst, src, n, bos_dst);
196 }
197
198 return __strncpy_chk2(dst, src, n, bos_dst, bos_src);
199}
George Burgess IV8a0cdb12019-10-21 13:27:57 -0700200#endif
George Burgess IVb97049c2017-07-24 15:05:05 -0700201
George Burgess IVb97049c2017-07-24 15:05:05 -0700202__BIONIC_FORTIFY_INLINE
zijunzhao6d23a082023-06-09 21:34:24 +0000203size_t strlcpy(char* _Nonnull const dst __pass_object_size, const char* _Nonnull src, size_t size)
George Burgess IV77f99aa2019-06-06 14:14:52 -0700204 __overloadable
205 __clang_error_if(__bos_unevaluated_lt(__bos(dst), size),
206 "'strlcpy' called with size bigger than buffer") {
Elliott Hughesf4ace9d2023-02-23 17:38:37 +0000207#if __BIONIC_FORTIFY_RUNTIME_CHECKS_ENABLED
George Burgess IV2f787652020-02-04 21:40:40 -0800208 return __strlcpy_chk(dst, src, size, __bos(dst));
209#else
George Burgess IVfd1ff4b2019-09-18 17:29:55 -0700210 return __call_bypassing_fortify(strlcpy)(dst, src, size);
George Burgess IV2f787652020-02-04 21:40:40 -0800211#endif
George Burgess IVb97049c2017-07-24 15:05:05 -0700212}
213
214__BIONIC_FORTIFY_INLINE
zijunzhao6d23a082023-06-09 21:34:24 +0000215size_t strlcat(char* _Nonnull const dst __pass_object_size, const char* _Nonnull src, size_t size)
George Burgess IV77f99aa2019-06-06 14:14:52 -0700216 __overloadable
217 __clang_error_if(__bos_unevaluated_lt(__bos(dst), size),
218 "'strlcat' called with size bigger than buffer") {
Elliott Hughesf4ace9d2023-02-23 17:38:37 +0000219#if __BIONIC_FORTIFY_RUNTIME_CHECKS_ENABLED
George Burgess IV2f787652020-02-04 21:40:40 -0800220 return __strlcat_chk(dst, src, size, __bos(dst));
George Burgess IVd02e7b12020-02-13 11:44:20 -0800221#else
George Burgess IVfd1ff4b2019-09-18 17:29:55 -0700222 return __call_bypassing_fortify(strlcat)(dst, src, size);
George Burgess IVd02e7b12020-02-13 11:44:20 -0800223#endif
George Burgess IVb97049c2017-07-24 15:05:05 -0700224}
225
Elliott Hughesf4ace9d2023-02-23 17:38:37 +0000226#if __BIONIC_FORTIFY_RUNTIME_CHECKS_ENABLED
George Burgess IV86da38c2024-08-05 13:02:51 -0600227/*
228 * Clang, when parsing C, can fold strlen to a constant without LLVM's help.
229 * This doesn't apply to overloads of strlen, so write this differently. We
230 * can't use `__pass_object_size0` here, but that's fine: it doesn't help much
231 * on __always_inline functions.
232 */
233extern __always_inline __inline__ __attribute__((gnu_inline)) size_t strlen(const char* _Nonnull s) {
George Burgess IVd02e7b12020-02-13 11:44:20 -0800234 return __strlen_chk(s, __bos0(s));
George Burgess IVfd1ff4b2019-09-18 17:29:55 -0700235}
George Burgess IVd02e7b12020-02-13 11:44:20 -0800236#endif
George Burgess IVb97049c2017-07-24 15:05:05 -0700237
George Burgess IVb97049c2017-07-24 15:05:05 -0700238__BIONIC_FORTIFY_INLINE
zijunzhao6d23a082023-06-09 21:34:24 +0000239char* _Nullable strchr(const char* _Nonnull const s __pass_object_size, int c) __overloadable {
Elliott Hughesf4ace9d2023-02-23 17:38:37 +0000240#if __BIONIC_FORTIFY_RUNTIME_CHECKS_ENABLED
George Burgess IVb97049c2017-07-24 15:05:05 -0700241 size_t bos = __bos(s);
242
George Burgess IVfd1ff4b2019-09-18 17:29:55 -0700243 if (bos != __BIONIC_FORTIFY_UNKNOWN_SIZE) {
244 return __strchr_chk(s, c, bos);
George Burgess IVb97049c2017-07-24 15:05:05 -0700245 }
George Burgess IV8a0cdb12019-10-21 13:27:57 -0700246#endif
George Burgess IVfd1ff4b2019-09-18 17:29:55 -0700247 return __builtin_strchr(s, c);
George Burgess IVb97049c2017-07-24 15:05:05 -0700248}
249
250__BIONIC_FORTIFY_INLINE
zijunzhao6d23a082023-06-09 21:34:24 +0000251char* _Nullable strrchr(const char* _Nonnull const s __pass_object_size, int c) __overloadable {
Elliott Hughesf4ace9d2023-02-23 17:38:37 +0000252#if __BIONIC_FORTIFY_RUNTIME_CHECKS_ENABLED
George Burgess IVb97049c2017-07-24 15:05:05 -0700253 size_t bos = __bos(s);
254
George Burgess IVfd1ff4b2019-09-18 17:29:55 -0700255 if (bos != __BIONIC_FORTIFY_UNKNOWN_SIZE) {
256 return __strrchr_chk(s, c, bos);
George Burgess IVb97049c2017-07-24 15:05:05 -0700257 }
George Burgess IV8a0cdb12019-10-21 13:27:57 -0700258#endif
George Burgess IVfd1ff4b2019-09-18 17:29:55 -0700259 return __builtin_strrchr(s, c);
260}
George Burgess IVb97049c2017-07-24 15:05:05 -0700261
Elliott Hughes95c6cd72019-12-20 13:26:14 -0800262#if __ANDROID_API__ >= 23 && __BIONIC_FORTIFY_RUNTIME_CHECKS_ENABLED
Elliott Hughesdf9a4892017-08-23 14:34:03 -0700263#if defined(__cplusplus)
264extern "C++" {
265__BIONIC_FORTIFY_INLINE
zijunzhao6d23a082023-06-09 21:34:24 +0000266void* _Nullable memrchr(void* _Nonnull const __pass_object_size s, int c, size_t n) {
Elliott Hughesdf9a4892017-08-23 14:34:03 -0700267 return __memrchr_fortify(s, c, n);
268}
269
270__BIONIC_FORTIFY_INLINE
zijunzhao6d23a082023-06-09 21:34:24 +0000271const void* _Nullable memrchr(const void* _Nonnull const __pass_object_size s, int c, size_t n) {
Elliott Hughesdf9a4892017-08-23 14:34:03 -0700272 return __memrchr_fortify(s, c, n);
273}
274}
275#else
276__BIONIC_FORTIFY_INLINE
zijunzhao6d23a082023-06-09 21:34:24 +0000277void* _Nullable memrchr(const void* _Nonnull const __pass_object_size s, int c, size_t n) __overloadable {
Elliott Hughesdf9a4892017-08-23 14:34:03 -0700278 return __memrchr_fortify(s, c, n);
279}
280#endif
Elliott Hughes95c6cd72019-12-20 13:26:14 -0800281#endif /* __ANDROID_API__ >= 23 */
Elliott Hughesdf9a4892017-08-23 14:34:03 -0700282
George Burgess IVb97049c2017-07-24 15:05:05 -0700283#endif /* defined(__BIONIC_FORTIFY) */