diff options
author | Georg Pfuetzenreuter | 2024-10-10 02:33:42 +0200 |
---|---|---|
committer | Georg Pfuetzenreuter | 2024-10-10 18:43:46 +0200 |
commit | 930839ab58a60a5e3026de6f8a659fdcd8c25173 (patch) | |
tree | e4a9814487f76716c063511ff5379c3647a05463 /build | |
parent | 91b0e21b7ac29d11d7c6774c92c99f4640a1a8d1 (diff) | |
download | watbot-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 'build')
0 files changed, 0 insertions, 0 deletions