From 995c2b2e80f8a6eb99636f02942f819ac8f93b43 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Duarte?= Date: Fri, 14 Jun 2024 15:51:49 +0100 Subject: [PATCH] fix: out of bounds access in `ListFlaggedPieces` --- extern/boostd-data/ldb/db.go | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/extern/boostd-data/ldb/db.go b/extern/boostd-data/ldb/db.go index 421029108..9cd68a5e4 100644 --- a/extern/boostd-data/ldb/db.go +++ b/extern/boostd-data/ldb/db.go @@ -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