summaryrefslogtreecommitdiff
path: root/libc/src/string/strcpy.cpp
diff options
context:
space:
mode:
authorAly ElAshram <71949028+AlyElashram@users.noreply.github.com>2025-06-04 20:08:27 +0300
committerGitHub <noreply@github.com>2025-06-04 13:08:27 -0400
commitff844df719d7226a46b8cb0d99aef9480cced247 (patch)
treeec4fdf604da96f6b652f4d44769383caa06ad884 /libc/src/string/strcpy.cpp
parentec5610c4a2ef15551fdfbe9c990851376f58efb6 (diff)
[libc] Expand usage of libc null checks. (#116262)
Fixes #111546 --------- Co-authored-by: alyyelashram <150528548+alyyelashram@users.noreply.github.com>
Diffstat (limited to 'libc/src/string/strcpy.cpp')
-rw-r--r--libc/src/string/strcpy.cpp2
1 files changed, 2 insertions, 0 deletions
diff --git a/libc/src/string/strcpy.cpp b/libc/src/string/strcpy.cpp
index 60b73ab3aa82..2013593db24a 100644
--- a/libc/src/string/strcpy.cpp
+++ b/libc/src/string/strcpy.cpp
@@ -8,6 +8,7 @@
#include "src/string/strcpy.h"
#include "src/__support/macros/config.h"
+#include "src/__support/macros/null_check.h"
#include "src/string/memory_utils/inline_memcpy.h"
#include "src/string/string_utils.h"
@@ -17,6 +18,7 @@ namespace LIBC_NAMESPACE_DECL {
LLVM_LIBC_FUNCTION(char *, strcpy,
(char *__restrict dest, const char *__restrict src)) {
+ LIBC_CRASH_ON_NULLPTR(dest);
size_t size = internal::string_length(src) + 1;
inline_memcpy(dest, src, size);
return dest;