summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Userland/Libraries/LibC/string.cpp5
-rw-r--r--Userland/Libraries/LibC/string.h2
2 files changed, 4 insertions, 3 deletions
diff --git a/Userland/Libraries/LibC/string.cpp b/Userland/Libraries/LibC/string.cpp
index 7e31d1f053..baed73c585 100644
--- a/Userland/Libraries/LibC/string.cpp
+++ b/Userland/Libraries/LibC/string.cpp
@@ -175,9 +175,10 @@ void* memmove(void* dest, void const* src, size_t n)
return dest;
}
-void const* memmem(void const* haystack, size_t haystack_length, void const* needle, size_t needle_length)
+// https://linux.die.net/man/3/memmem (GNU extension)
+void* memmem(void const* haystack, size_t haystack_length, void const* needle, size_t needle_length)
{
- return AK::memmem(haystack, haystack_length, needle, needle_length);
+ return const_cast<void*>(AK::memmem(haystack, haystack_length, needle, needle_length));
}
// https://pubs.opengroup.org/onlinepubs/9699919799/functions/strcpy.html
diff --git a/Userland/Libraries/LibC/string.h b/Userland/Libraries/LibC/string.h
index ba9787d4a8..8a1b6b631c 100644
--- a/Userland/Libraries/LibC/string.h
+++ b/Userland/Libraries/LibC/string.h
@@ -28,7 +28,7 @@ int timingsafe_memcmp(void const*, void const*, size_t);
void* memcpy(void*, void const*, size_t);
void* memmove(void*, void const*, size_t);
void* memchr(void const*, int c, size_t);
-void const* memmem(void const* haystack, size_t, void const* needle, size_t);
+void* memmem(void const* haystack, size_t, void const* needle, size_t);
void* memset(void*, int, size_t);
void explicit_bzero(void*, size_t) __attribute__((nonnull(1)));