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

Commit

Permalink
Merge pull request #162 from facebookresearch/heiner/fix-bufferoverflow
Browse files Browse the repository at this point in the history
Fix a bad buffer overflow in inv_strs.
  • Loading branch information
Heinrich Kuttler authored Jun 6, 2021
2 parents cf877c2 + 8b927bf commit e464dba
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 e464dba

Please sign in to comment.