Making the config say not to put a 0 at the beginning could work. Because what is happening is that the number is being seen as octal and if you have an 8 or 9 anywhere in the string, the conversion stops there.
After a little digging, it seems that the proper solution is 2 things. First being that we shouldn't have the base set to 0, but rather to 10. Second being that we need to be resetting errno before each strtol call we make and then only check the value of errno for it to be 0 or not (right now it's checking the value of *endptr, which is not indicative of an error).