Fix buffer overflow in print_number().

Refs #4865