diff --git a/CHANGELOG.md b/CHANGELOG.md index 35eeef69..b9467c57 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,7 @@ - Changed - Explicitly allow TLS1.0 - Fix markdown output file format + - Fixed divide by 0 error when setting rate limit to 0 manually. - v2.0.0 - New diff --git a/CONTRIBUTORS.md b/CONTRIBUTORS.md index 1ac6520b..4f768e74 100644 --- a/CONTRIBUTORS.md +++ b/CONTRIBUTORS.md @@ -14,6 +14,7 @@ * [Daviey](https://github.com/Daviey) * [delic](https://github.com/delic) * [denandz](https://github.com/denandz) +* [Ephex2](https://github.com/Ephex2) * [erbbysam](https://github.com/erbbysam) * [eur0pa](https://github.com/eur0pa) * [fabiobauer](https://github.com/fabiobauer) @@ -46,4 +47,3 @@ * [SolomonSklash](https://github.com/SolomonSklash) * [TomNomNom](https://github.com/tomnomnom) * [xfgusta](https://github.com/xfgusta) - diff --git a/pkg/ffuf/rate.go b/pkg/ffuf/rate.go index 48a69404..e8a0f50c 100644 --- a/pkg/ffuf/rate.go +++ b/pkg/ffuf/rate.go @@ -65,7 +65,12 @@ func (r *RateThrottle) CurrentRate() int64 { } func (r *RateThrottle) ChangeRate(rate int) { - ratemicros := 1000000 / rate + ratemicros := 0 // set default to 0, avoids integer divide by 0 error + + if rate != 0 { + ratemicros = 1000000 / rate + } + r.RateLimiter.Stop() r.RateLimiter = time.NewTicker(time.Microsecond * time.Duration(ratemicros)) r.Config.Rate = int64(rate)