sysinfo: Simplify remove_leading_whitespace()

Also fixes a possible overflow