network_parser: Sanitize buffer state between calls and between parsed lines
Whenever we have finished parsing a line, the destination buffer must
be zeroed out to prevent stale data from corrupting the data.
Once data is copied from the receive buffer to the last_line buffer
and the receive buffer is moved back to the beginning, we must zero
out the old data at the end of the buffer to prevent corrupting any
new data. This can happen if we receive multiple lines in one recv()
call.
When we have finished handling one set of data, we should clear the
buffer state and data to prevent any stale data from corrupting the
data on next call. This could happen for example if the TCP transfer
is interrupted for any reason and we don't receive comlete line for
any reason.
Signed-off-by: Timo Kokkonen <timo.t.kokkonen@iki.fi>