Copy inbuf to prevent data being overwritten