Skip to content

Commit ff7d140

Browse files
authored
fix: out of bounds access in ListFlaggedPieces (#1927)
1 parent 23ae0d6 commit ff7d140

File tree

1 file changed

+4
-2
lines changed
  • extern/boostd-data/ldb

1 file changed

+4
-2
lines changed

extern/boostd-data/ldb/db.go

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -785,8 +785,10 @@ func (db *DB) ListFlaggedPieces(ctx context.Context, filter *types.FlaggedPieces
785785
}
786786
}
787787

788-
if len(records) > limit {
789-
records = records[:limit]
788+
if limit > 0 {
789+
if len(records) > limit {
790+
records = records[:limit]
791+
}
790792
}
791793

792794
return records, nil

0 commit comments

Comments
 (0)