Add safeguard against buffer overflow when calling scanf.