diff options
| author | Aly ElAshram <71949028+AlyElashram@users.noreply.github.com> | 2025-06-04 20:08:27 +0300 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-06-04 13:08:27 -0400 |
| commit | ff844df719d7226a46b8cb0d99aef9480cced247 (patch) | |
| tree | ec4fdf604da96f6b652f4d44769383caa06ad884 /libc/src/string/strlen.cpp | |
| parent | ec5610c4a2ef15551fdfbe9c990851376f58efb6 (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/strlen.cpp')
| -rw-r--r-- | libc/src/string/strlen.cpp | 2 |
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); } |
