mbuffer_st.type is not preserved when linearized
Description of problem:
When received data is too short to contain a message header, they are temporarily buffered in somewhere and when the next segment is arrived, they are gathered into one buffer (linearized). I'm specifically looking at this code: https://gitlab.com/gnutls/gnutls/-/blob/7f3ea9acc2a2da1d697d423514dfa9c3b56acb15/lib/buffers.c#L1259
The problem is, when the buffers are linearized, mbuffer_st type is cleared. Next time we hit https://gitlab.com/gnutls/gnutls/-/blob/7f3ea9acc2a2da1d697d423514dfa9c3b56acb15/lib/buffers.c#L1217, the check fails, and the endpoint sends fatal alert with unexpected message.
Version of gnutls used:
3.7.3
Distributor of gnutls (e.g., Ubuntu, Fedora, RHEL)
How reproducible:
Steps to Reproduce:
I think feeding data ends in the middle of a message header to gnutls_session_t via gnutls_handshake_write would trigger this bug. For myself, I discovered it when testing client certificate authentication as QUIC client.