From e2b5a8c8ea80d0b1d57428d3ae3f6f95f98e543d Mon Sep 17 00:00:00 2001 From: Andrew Ayer Date: Mon, 13 Nov 2023 14:35:24 -0500 Subject: [PATCH] Fix bug when fetching entries This bug caused certspotter to always request 1000 entries even if went beyond the size of the log. This would have prevented certspotter from downloading entries near the end of the log, if the log was strict with get-entries bounds. In practice, none of the active CT logs are strict with get-entries bounds, and even if a log were strict, certspotter would have been able to successfully download the entries later once the log grew. --- monitor/monitor.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/monitor/monitor.go b/monitor/monitor.go index 3bf7414..a97013d 100644 --- a/monitor/monitor.go +++ b/monitor/monitor.go @@ -234,7 +234,7 @@ func monitorLog(ctx context.Context, config *Config, ctlog *loglist.Log, logClie func downloadEntries(ctx context.Context, logClient *client.LogClient, entriesChan chan<- client.GetEntriesItem, begin, end uint64) error { for begin < end && ctx.Err() == nil { - size := begin - end + size := end - begin if size > maxGetEntriesSize { size = maxGetEntriesSize }