base58: add paranoid return value checks

Always clear buffers and check return values.