-
Notifications
You must be signed in to change notification settings - Fork 2.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Enforce valid spec-conformant string encoding in TLV #30393
Changes from all commits
5a05641
abdf8db
fe9104e
ab7447d
cc341f7
c365f5b
5ab9f20
08cdf5f
e0672dc
a7f6fdb
4d625bb
8202ba5
05e7767
6993d19
20101ae
207c7a7
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -209,6 +209,7 @@ struct SceneTableData : public SceneTableEntry, PersistentData<kPersistentSceneB | |
|
||
CHIP_ERROR Serialize(TLV::TLVWriter & writer) const override | ||
{ | ||
// TODO: if we have mNameLength, should this bin ByteSpan instead? | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I don't understand this comment. |
||
CharSpan nameSpan(mStorageData.mName, mStorageData.mNameLength); | ||
TLV::TLVType container; | ||
ReturnErrorOnFailure(writer.StartContainer(TLV::AnonymousTag(), TLV::kTLVType_Structure, container)); | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -551,7 +551,7 @@ void TimeSynchronizationServer::InitTimeZone() | |
for (auto & tzStore : mTimeZoneObj.timeZoneList) | ||
{ | ||
memset(tzStore.name, 0, sizeof(tzStore.name)); | ||
tzStore.timeZone = { .offset = 0, .validAt = 0, .name = MakeOptional(CharSpan(tzStore.name, sizeof(tzStore.name))) }; | ||
tzStore.timeZone = { .offset = 0, .validAt = 0, .name = MakeOptional(CharSpan(tzStore.name, 0)) }; | ||
andy31415 marked this conversation as resolved.
Show resolved
Hide resolved
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This looks wrong to me. The right thing to set |
||
} | ||
} | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -581,7 +581,14 @@ using CHIP_ERROR = ::chip::ChipError; | |
*/ | ||
#define CHIP_ERROR_WRONG_ENCRYPTION_TYPE CHIP_CORE_ERROR(0x11) | ||
|
||
// AVAILABLE: 0x12 | ||
/** | ||
* @def CHIP_ERROR_INVALID_UTF8 | ||
* | ||
* @brief | ||
* Invalid UTF8 string (contains some characters that are invalid) | ||
* | ||
*/ | ||
#define CHIP_ERROR_INVALID_UTF8 CHIP_CORE_ERROR(0x12) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Please align the indentation with the other errors. |
||
|
||
/** | ||
* @def CHIP_ERROR_INTEGRITY_CHECK_FAILED | ||
|
@@ -602,7 +609,15 @@ using CHIP_ERROR = ::chip::ChipError; | |
*/ | ||
#define CHIP_ERROR_INVALID_SIGNATURE CHIP_CORE_ERROR(0x14) | ||
|
||
// AVAILABLE: 0x15 | ||
/** | ||
* @def CHIP_ERROR_INVALID_TLV_CHAR_STRING | ||
* | ||
* @brief | ||
* Invalid TLV character string (e.g. null terminator) | ||
* | ||
*/ | ||
#define CHIP_ERROR_INVALID_TLV_CHAR_STRING CHIP_CORE_ERROR(0x15) | ||
andy31415 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
// AVAILABLE: 0x16 | ||
|
||
/** | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please use
"Hot"_span
next time @andreilitvin