When processing input, don't run off the end of the buffer!