From ba0efff2009d0aa8cd054b222b4ea58b978ce0ba Mon Sep 17 00:00:00 2001 From: ephex Date: Sat, 8 Jul 2023 16:14:24 -0400 Subject: [PATCH 1/3] added check to RateThrottle.ChangeRate() in rate.go to prevent a divide by 0 error when the rate is set to 0. Ref: issue 696: https://github.com/ffuf/ffuf/issues/696 --- pkg/ffuf/rate.go | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) 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) From 548e46d1deece014e35bff144907b1a6ac3ea80b Mon Sep 17 00:00:00 2001 From: ephex Date: Sat, 8 Jul 2023 16:19:26 -0400 Subject: [PATCH 2/3] added name to contributors.md and small change description to changelog.md as requested in PR doc --- CHANGELOG.md | 1 + CONTRIBUTORS.md | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) 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..7a2f52be 100644 --- a/CONTRIBUTORS.md +++ b/CONTRIBUTORS.md @@ -46,4 +46,4 @@ * [SolomonSklash](https://github.com/SolomonSklash) * [TomNomNom](https://github.com/tomnomnom) * [xfgusta](https://github.com/xfgusta) - +* [Ephex2](https://github.com/Ephex2) \ No newline at end of file From dc1a091ef55a45dd88c35a1675d31fccb7c1ecd0 Mon Sep 17 00:00:00 2001 From: Joona Hoikkala <5235109+joohoi@users.noreply.github.com> Date: Wed, 13 Sep 2023 11:28:34 +0300 Subject: [PATCH 3/3] Update CONTRIBUTORS.md --- CONTRIBUTORS.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CONTRIBUTORS.md b/CONTRIBUTORS.md index 7a2f52be..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) -* [Ephex2](https://github.com/Ephex2) \ No newline at end of file