summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEmily Trau <emily@downunderctf.com>2023-06-04 16:49:09 -0700
committerAndreas Kling <kling@serenityos.org>2023-06-05 06:55:54 +0200
commite6970ec5f4f56cafe63553b7a40040d7c3f9c197 (patch)
tree35014ca43b8841f3c6b98dd345a46743c9c89b2c
parent04b06afd39f7a2600e5c9b4e5db3e2030ef8c755 (diff)
downloadserenity-e6970ec5f4f56cafe63553b7a40040d7c3f9c197.zip
LibC: Add missing spec links for string APIs
-rw-r--r--Userland/Libraries/LibC/string.cpp7
1 files changed, 7 insertions, 0 deletions
diff --git a/Userland/Libraries/LibC/string.cpp b/Userland/Libraries/LibC/string.cpp
index baed73c585..a1753b5c81 100644
--- a/Userland/Libraries/LibC/string.cpp
+++ b/Userland/Libraries/LibC/string.cpp
@@ -126,6 +126,8 @@ int memcmp(void const* v1, void const* v2, size_t n)
return 0;
}
+// Not in POSIX, originated in BSD
+// https://man.openbsd.org/timingsafe_memcmp.3
int timingsafe_memcmp(void const* b1, void const* b2, size_t len)
{
return AK::timing_safe_compare(b1, b2, len) ? 1 : 0;
@@ -201,6 +203,8 @@ char* strncpy(char* dest, char const* src, size_t n)
return dest;
}
+// Not in POSIX, originated in BSD but also supported on Linux.
+// https://man.openbsd.org/strlcpy.3
size_t strlcpy(char* dest, char const* src, size_t n)
{
size_t i;
@@ -232,6 +236,7 @@ char* index(char const* str, int c)
return strchr(str, c);
}
+// https://linux.die.net/man/3/strchrnul (GNU extension)
char* strchrnul(char const* str, int c)
{
char ch = c;
@@ -485,6 +490,8 @@ char* strsep(char** str, char const* delim)
return begin;
}
+// Not in POSIX, originated in BSD but also supported on Linux.
+// https://man.openbsd.org/explicit_bzero.3
void explicit_bzero(void* ptr, size_t size)
{
secure_zero(ptr, size);