1
0
mirror of synced 2024-11-28 09:30:51 +01:00

Fix buffer sizes of PatternDataString16 (#339)

This commit is contained in:
qdlmcfresh 2021-11-11 13:24:01 +01:00 committed by GitHub
parent 594a6c1c0f
commit 2e3c43ad9e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -679,7 +679,7 @@ namespace hex::pl {
void createEntry(prv::Provider* &provider) override {
auto size = std::min<size_t>(this->getSize(), 0x100);
std::u16string buffer(size, 0x00);
std::u16string buffer(this->getSize()/sizeof(char16_t), 0x00);
provider->read(this->getOffset(), buffer.data(), size);
for (auto &c : buffer)
@ -699,8 +699,8 @@ namespace hex::pl {
}
[[nodiscard]] std::string toString(prv::Provider *provider) const override {
std::u16string buffer(this->getSize(), 0x00);
provider->read(this->getOffset(), buffer.data(), buffer.size());
std::u16string buffer(this->getSize()/sizeof(char16_t), 0x00);
provider->read(this->getOffset(), buffer.data(), this->getSize());
for (auto &c : buffer)
c = hex::changeEndianess(c, 2, this->getEndian());