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 8b927bf
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions win/rl/winrl.cc
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
#include <memory>
#include <stdio.h>
#include <string>
#include <cstring>
#include <unistd.h>
#include <vector>

Expand Down Expand Up @@ -384,7 +383,8 @@ 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 = 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 8b927bf

Please sign in to comment.