From e6970ec5f4f56cafe63553b7a40040d7c3f9c197 Mon Sep 17 00:00:00 2001 From: Emily Trau Date: Sun, 4 Jun 2023 16:49:09 -0700 Subject: LibC: Add missing spec links for string APIs --- Userland/Libraries/LibC/string.cpp | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'Userland/Libraries') 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); -- cgit v1.2.3