Buffer overflow detection

This fixes the bug discovered by Enginwiz, the remaining line input
that overflows the input buffer is now ignored.