Fix strtoul 'endptr' return value: It should point to the first invalid character,

not to the last valid character.