summaryrefslogtreecommitdiffstats
path: root/wat/utils.go
Commit message (Collapse)AuthorAgeFilesLines
* Prevent dice overflowGeorg Pfuetzenreuter2024-10-101-0/+22
rand.Int() would panic when the max value is <= 0, which happens when big.NewInt() was fed with a too large number. Avoid this by validating the big.NewInt() return beforehand. Add error handling to all callers to both gracefully return to IRC and to log an error message. Rename the shadowed "max" variable whilst at it to avoid confusion. Signed-off-by: Georg Pfuetzenreuter <mail@georg-pfuetzenreuter.net>