From a2dc29022173f08240f370c55fc70cb7d706ec7c Mon Sep 17 00:00:00 2001 From: Jonathan Hui Date: Tue, 4 Oct 2016 15:45:23 -0700 Subject: [PATCH] Perform args checking before causing side effects. (#746) --- src/core/thread/meshcop_tlvs.hpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/core/thread/meshcop_tlvs.hpp b/src/core/thread/meshcop_tlvs.hpp index 99f3477d8..03be430a9 100644 --- a/src/core/thread/meshcop_tlvs.hpp +++ b/src/core/thread/meshcop_tlvs.hpp @@ -1529,8 +1529,8 @@ public: ThreadError error = kThreadError_None; size_t len = aProvisioningUrl ? strnlen(aProvisioningUrl, kMaxLength + 1) : 0; - SetLength(static_cast(len)); VerifyOrExit(len <= kMaxLength, error = kThreadError_InvalidArgs); + SetLength(static_cast(len)); if (len > 0) { memcpy(mProvisioningUrl, aProvisioningUrl, len);