core: Fix unintential integer overflow

The expression would be evaluated as 32bit unsigned before
promoting to 64bit unsigned so cast the strtoul return value to
avoid integer overflows. Please note that the value passed here
comes from the user.

Reported by Coverity as CID #971244.
Merge pull request #465 from xrmx/coverity2211-2

core: Fix unintentonal integer overflow