Skip to content

Commit

Permalink
Use v on read for size instead of len
Browse files Browse the repository at this point in the history
  • Loading branch information
andy31415 committed Nov 9, 2023
1 parent 6993d19 commit 20101ae
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/lib/core/TLVReader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -345,7 +345,7 @@ CHIP_ERROR TLVReader::Get(CharSpan & v) const
return CHIP_ERROR_INVALID_UTF8;
}

if ((len > 0) && (v[len - 1] == 0))
if (!v.empty() && (v.back() == 0))
{
return CHIP_ERROR_INVALID_TLV_CHAR_STRING;
}
Expand Down

0 comments on commit 20101ae

Please sign in to comment.