-
Notifications
You must be signed in to change notification settings - Fork 158
Description
While usually more than one object is serialized in a byte buffer, there might be situations where you just expect one object from a byte buffer. In other words, there is currently no counterpart to tls_serialized_detached()
.
The motivation behind this is that the TLS encoding implicitly guarantees that at least the required number of bytes indicated in the length prefix have been read, but you don't know if any trailing bytes are left after deserializing an object unless you try to deserialize another object or do a manual check.
I would propose something like tls_deserialize_detached()
(or whatever other name is more suitable) that takes ownership of the Read
and after internally calling tls_deserialize
it checks if it can read one more byte and if so, returns an error.