lib/util: Input validation in str_to_uint