Cleanup imports.
Only keep meaningful-part of the buffer.
Move the "read-until \0" to a dedicated function.

Will allow us to recompute the CRC from original data.