fixed buffer overflow and allow unused bytes to be kept for the next action

1. Fixes buffer overflow in the loop which reads data `client.read()` into the buffer. Now the loop will stop reading if the `buffer` full.
2. If after processing all bytes of data, there still are bytes remaining (unused bytes), these are left at the beginning of the `buffer` to be used in the next `processInputs`