summaryrefslogtreecommitdiffstats
path: root/init
diff options
context:
space:
mode:
authorGeorg Pfuetzenreuter2024-10-10 02:33:42 +0200
committerGeorg Pfuetzenreuter2024-10-10 18:43:46 +0200
commit930839ab58a60a5e3026de6f8a659fdcd8c25173 (patch)
treee4a9814487f76716c063511ff5379c3647a05463 /init
parent91b0e21b7ac29d11d7c6774c92c99f4640a1a8d1 (diff)
downloadwatbot-930839ab58a60a5e3026de6f8a659fdcd8c25173.tar.gz
watbot-930839ab58a60a5e3026de6f8a659fdcd8c25173.tar.bz2
watbot-930839ab58a60a5e3026de6f8a659fdcd8c25173.zip
Prevent dice overflow
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>
Diffstat (limited to 'init')
0 files changed, 0 insertions, 0 deletions