[cli] add ping interval bounds check to avoid Timer::Start() assert (#3507)

This commit is contained in:
Jonathan Hui
2019-01-25 08:35:44 -08:00
committed by GitHub
parent 560d9350b2
commit 993f537a03
+4 -3
View File
@@ -1923,15 +1923,16 @@ void Interpreter::ProcessPing(int argc, char *argv[])
switch (index)
{
case 1:
mLength = (uint16_t)value;
mLength = static_cast<uint16_t>(value);
break;
case 2:
mCount = (uint16_t)value;
mCount = static_cast<uint16_t>(value);
break;
case 3:
mInterval = (uint32_t)value;
mInterval = static_cast<uint32_t>(value);
VerifyOrExit(mInterval <= Timer::kMaxDt, error = OT_ERROR_INVALID_ARGS);
mInterval = mInterval * 1000;
break;