diff --git a/src/core/coap/coap_message.cpp b/src/core/coap/coap_message.cpp index 3f34b5d71..56c90d210 100644 --- a/src/core/coap/coap_message.cpp +++ b/src/core/coap/coap_message.cpp @@ -39,6 +39,7 @@ #include "common/encoding.hpp" #include "common/instance.hpp" #include "common/random.hpp" +#include "common/string.hpp" namespace ot { namespace Coap { @@ -229,7 +230,7 @@ Error Message::AppendUriPathOptions(const char *aUriPath) const char *cur = aUriPath; const char *end; - while ((end = strchr(cur, '/')) != nullptr) + while ((end = StringFind(cur, '/')) != nullptr) { SuccessOrExit(error = AppendOption(kOptionUriPath, static_cast(end - cur), cur)); cur = end + 1; diff --git a/src/core/utils/parse_cmdline.cpp b/src/core/utils/parse_cmdline.cpp index e2f5f5a91..1893aeb36 100644 --- a/src/core/utils/parse_cmdline.cpp +++ b/src/core/utils/parse_cmdline.cpp @@ -37,6 +37,7 @@ #include "common/code_utils.hpp" #include "common/numeric_limits.hpp" +#include "common/string.hpp" #include "net/ip6_address.hpp" namespace ot { @@ -258,7 +259,7 @@ Error ParseAsIp6Prefix(const char *aString, otIp6Prefix &aPrefix) char string[kMaxIp6AddressStringSize]; const char *prefixLengthStr; - prefixLengthStr = strchr(aString, '/'); + prefixLengthStr = StringFind(aString, '/'); VerifyOrExit(prefixLengthStr != nullptr); VerifyOrExit(prefixLengthStr - aString < static_cast(sizeof(string)));