libc: Fix parsing of hexadecimal numbers in strtol() family.
This had previously been partly fixed in 2571c7f7200f.
MFC after: 1 week
Reviewed by: imp, allanjude, emaste
Differential Revision: https://reviews.freebsd.org/D41510
(cherry picked from commit b8b6bef43f876a0a0b8c0b4ae65135bcab4c7aa6)