Skip to content

Commit beb57d9

Browse files
committed
Add NullChecks to strsep.cpp
1 parent 981eab0 commit beb57d9

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

libc/src/string/strsep.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
#include "src/string/strsep.h"
1010

1111
#include "src/__support/macros/config.h"
12+
#include "src/__support/macros/null_check.h"
1213
#include "src/string/string_utils.h"
1314

1415
namespace LIBC_NAMESPACE_DECL {
@@ -17,6 +18,7 @@ LLVM_LIBC_FUNCTION(char *, strsep,
1718
(char **__restrict stringp, const char *__restrict delim)) {
1819
if (!*stringp)
1920
return nullptr;
21+
LIBC_CRASH_ON_NULLPTR(delim);
2022
return internal::string_token<false>(*stringp, delim, stringp);
2123
}
2224

0 commit comments

Comments
 (0)