fix unsafe memory access in PSOBBEncryption

This commit is contained in:
Martin Michelsen
2022-05-12 11:45:20 -07:00
parent 71d78839a4
commit 307eef88d0
4 changed files with 162 additions and 139 deletions
+13
View File
@@ -218,6 +218,19 @@ struct parray {
return this->items;
}
ItemT& operator[](size_t index) {
if (index >= Count) {
throw std::out_of_range("array index out of bounds");
}
return this->items[index];
}
const ItemT& operator[](size_t index) const {
if (index >= Count) {
throw std::out_of_range("array index out of bounds");
}
return this->items[index];
}
// TODO: These can be made faster by only clearing the unused space after the
// strncpy_t (if any) instead of clearing all the space every time
parray& operator=(const parray& s) {