summaryrefslogtreecommitdiff
path: root/libc/src/string/strlen.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'libc/src/string/strlen.cpp')
-rw-r--r--libc/src/string/strlen.cpp2
1 files changed, 2 insertions, 0 deletions
diff --git a/libc/src/string/strlen.cpp b/libc/src/string/strlen.cpp
index ff7ab14dd313..234edb81d4c8 100644
--- a/libc/src/string/strlen.cpp
+++ b/libc/src/string/strlen.cpp
@@ -8,6 +8,7 @@
#include "src/string/strlen.h"
#include "src/__support/macros/config.h"
+#include "src/__support/macros/null_check.h"
#include "src/string/string_utils.h"
#include "src/__support/common.h"
@@ -17,6 +18,7 @@ namespace LIBC_NAMESPACE_DECL {
// TODO: investigate the performance of this function.
// There might be potential for compiler optimization.
LLVM_LIBC_FUNCTION(size_t, strlen, (const char *src)) {
+ LIBC_CRASH_ON_NULLPTR(src);
return internal::string_length(src);
}