mirror of
https://github.com/espressif/openthread.git
synced 2026-08-13 06:07:48 +00:00
Perform args checking before causing side effects. (#746)
This commit is contained in:
@@ -1529,8 +1529,8 @@ public:
|
||||
ThreadError error = kThreadError_None;
|
||||
size_t len = aProvisioningUrl ? strnlen(aProvisioningUrl, kMaxLength + 1) : 0;
|
||||
|
||||
SetLength(static_cast<uint8_t>(len));
|
||||
VerifyOrExit(len <= kMaxLength, error = kThreadError_InvalidArgs);
|
||||
SetLength(static_cast<uint8_t>(len));
|
||||
|
||||
if (len > 0) {
|
||||
memcpy(mProvisioningUrl, aProvisioningUrl, len);
|
||||
|
||||
Reference in New Issue
Block a user