summaryrefslogtreecommitdiff
path: root/payloads/libpayload/libc/memory.c
diff options
context:
space:
mode:
Diffstat (limited to 'payloads/libpayload/libc/memory.c')
-rw-r--r--payloads/libpayload/libc/memory.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/payloads/libpayload/libc/memory.c b/payloads/libpayload/libc/memory.c
index 25c2b3af4f..8ee3eed9da 100644
--- a/payloads/libpayload/libc/memory.c
+++ b/payloads/libpayload/libc/memory.c
@@ -145,3 +145,15 @@ static int default_memcmp(const void *s1, const void *s2, size_t n)
int memcmp(const void *s1, const void *s2, size_t n)
__attribute__((weak, alias("default_memcmp")));
+
+
+void *memchr(const void *s, int c, size_t n)
+{
+ unsigned char *p = (unsigned char *)s;
+ while (n--)
+ if (*p != (unsigned char)c)
+ p++;
+ else
+ return p;
+ return 0;
+}