mirror of
https://github.com/espressif/openthread.git
synced 2026-10-01 13:27:42 +00:00
[cmd-parser] add nullptr check to ParseHexString() (#6779)
This commit is contained in:
@@ -302,12 +302,17 @@ enum HexStringParseMode
|
|||||||
|
|
||||||
static Error ParseHexString(const char *&aString, uint16_t &aSize, uint8_t *aBuffer, HexStringParseMode aMode)
|
static Error ParseHexString(const char *&aString, uint16_t &aSize, uint8_t *aBuffer, HexStringParseMode aMode)
|
||||||
{
|
{
|
||||||
Error error = kErrorNone;
|
Error error = kErrorNone;
|
||||||
size_t stringLength = strlen(aString);
|
size_t parsedSize = 0;
|
||||||
size_t expectedSize = (stringLength + 1) / 2;
|
size_t stringLength;
|
||||||
size_t parsedSize = 0;
|
size_t expectedSize;
|
||||||
bool skipFirstDigit;
|
bool skipFirstDigit;
|
||||||
|
|
||||||
|
VerifyOrExit(aString != nullptr, error = kErrorInvalidArgs);
|
||||||
|
|
||||||
|
stringLength = strlen(aString);
|
||||||
|
expectedSize = (stringLength + 1) / 2;
|
||||||
|
|
||||||
switch (aMode)
|
switch (aMode)
|
||||||
{
|
{
|
||||||
case kModeExtactSize:
|
case kModeExtactSize:
|
||||||
|
|||||||
Reference in New Issue
Block a user