增加对len的限制

Signed-off-by: srr101 <songruirui1@huawei.com>
This commit is contained in:
srr101
2023-05-05 15:07:05 +08:00
parent e4a73b8ec2
commit 6c2db5e866
2 changed files with 4 additions and 0 deletions
@@ -37,6 +37,7 @@ struct ChangeInfo {
mutable std::list<Uri> uris_ = {};
const void *data_ = nullptr;
uint32_t size_ = 0;
static constexpr int LIST_MAX_COUNT = 3000;
};
} // namespace AAFwk
} // namespace OHOS
@@ -53,6 +53,9 @@ bool ChangeInfo::Unmarshalling(ChangeInfo &output, MessageParcel &parcel)
if (!parcel.ReadUint32(len)) {
return false;
}
if (len > LIST_MAX_COUNT) {
return false;
}
std::list<Uri> uris;
for (uint32_t i = 0; i < len; i++) {