Skip to content

tls_codec: Add function to ensure all bytes have been consumed #219

@raphaelrobert

Description

@raphaelrobert

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.

Metadata

Metadata

Labels

questionFurther information is requested

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions