Fix Issue696 -- Divide by 0 Error when setting rate to 0 manually (#700)
* 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 * added name to contributors.md and small change description to changelog.md as requested in PR doc * Update CONTRIBUTORS.md --------- Co-authored-by: Joona Hoikkala <5235109+joohoi@users.noreply.github.com>
This commit is contained in:
parent
301968cb1c
commit
96fef6213d
@ -5,6 +5,7 @@
|
|||||||
- Changed
|
- Changed
|
||||||
- Explicitly allow TLS1.0
|
- Explicitly allow TLS1.0
|
||||||
- Fix markdown output file format
|
- Fix markdown output file format
|
||||||
|
- Fixed divide by 0 error when setting rate limit to 0 manually.
|
||||||
|
|
||||||
- v2.0.0
|
- v2.0.0
|
||||||
- New
|
- New
|
||||||
|
|||||||
@ -14,6 +14,7 @@
|
|||||||
* [Daviey](https://github.com/Daviey)
|
* [Daviey](https://github.com/Daviey)
|
||||||
* [delic](https://github.com/delic)
|
* [delic](https://github.com/delic)
|
||||||
* [denandz](https://github.com/denandz)
|
* [denandz](https://github.com/denandz)
|
||||||
|
* [Ephex2](https://github.com/Ephex2)
|
||||||
* [erbbysam](https://github.com/erbbysam)
|
* [erbbysam](https://github.com/erbbysam)
|
||||||
* [eur0pa](https://github.com/eur0pa)
|
* [eur0pa](https://github.com/eur0pa)
|
||||||
* [fabiobauer](https://github.com/fabiobauer)
|
* [fabiobauer](https://github.com/fabiobauer)
|
||||||
@ -47,4 +48,3 @@
|
|||||||
* [SolomonSklash](https://github.com/SolomonSklash)
|
* [SolomonSklash](https://github.com/SolomonSklash)
|
||||||
* [TomNomNom](https://github.com/tomnomnom)
|
* [TomNomNom](https://github.com/tomnomnom)
|
||||||
* [xfgusta](https://github.com/xfgusta)
|
* [xfgusta](https://github.com/xfgusta)
|
||||||
|
|
||||||
|
|||||||
@ -65,7 +65,12 @@ func (r *RateThrottle) CurrentRate() int64 {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (r *RateThrottle) ChangeRate(rate int) {
|
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.Stop()
|
||||||
r.RateLimiter = time.NewTicker(time.Microsecond * time.Duration(ratemicros))
|
r.RateLimiter = time.NewTicker(time.Microsecond * time.Duration(ratemicros))
|
||||||
r.Config.Rate = int64(rate)
|
r.Config.Rate = int64(rate)
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user