Skip to content

Commit 09f6803

Browse files
committed
Limit reads from untrusted sources
1 parent 90be20d commit 09f6803

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

service.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright (c) 2017-2025 The Decred developers
1+
// Copyright (c) 2017-2026 The Decred developers
22
// Use of this source code is governed by an ISC
33
// license that can be found in the LICENSE file.
44

@@ -190,7 +190,7 @@ func (service *Service) getHTTP(url string) ([]byte, error) {
190190
url, poolResp.StatusCode)
191191
}
192192

193-
respBody, err := io.ReadAll(poolResp.Body)
193+
respBody, err := io.ReadAll(io.LimitReader(poolResp.Body, 1<<20)) // 1 MiB limit
194194
if err != nil {
195195
return nil, fmt.Errorf("%v: failed to read body: %w", url, err)
196196
}

0 commit comments

Comments
 (0)