Skip to content
This repository has been archived by the owner on May 6, 2024. It is now read-only.

Commit

Permalink
Fix a bad buffer overflow in inv_strs.
Browse files Browse the repository at this point in the history
  • Loading branch information
Heinrich Kuttler committed Jun 5, 2021
1 parent cf877c2 commit 36db803
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion win/rl/winrl.cc
Original file line number Diff line number Diff line change
Expand Up @@ -384,7 +384,9 @@ NetHackRL::fill_obs(nle_obs *obs)
int i = 0;
for (const rl_inventory_item &item : inventory_) {
int j = 0;
for (int size = item.str.size(); j < size; ++j) {
for (int size =
std::min(item.str.size(), NLE_INVENTORY_STR_LENGTH);
j < size; ++j) {
obs->inv_strs[i++] = item.str[j];
}
for (; j < NLE_INVENTORY_STR_LENGTH; ++j) {
Expand Down

0 comments on commit 36db803

Please sign in to comment.