Skip to content

Commit

Permalink
fix: out of bounds access in ListFlaggedPieces (#1927)
Browse files Browse the repository at this point in the history
  • Loading branch information
jmg-duarte authored Jun 17, 2024
1 parent 23ae0d6 commit ff7d140
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions extern/boostd-data/ldb/db.go
Original file line number Diff line number Diff line change
Expand Up @@ -785,8 +785,10 @@ func (db *DB) ListFlaggedPieces(ctx context.Context, filter *types.FlaggedPieces
}
}

if len(records) > limit {
records = records[:limit]
if limit > 0 {
if len(records) > limit {
records = records[:limit]
}
}

return records, nil
Expand Down

0 comments on commit ff7d140

Please sign in to comment.