[libc] Fix a validation bug in strtoul()