CHERIoT-Platform / network-stack

5 stars 1 forks source link

Fix `tls_connection_receive_preallocated`. #3

Closed hlef closed 7 months ago

hlef commented 7 months ago

There was a bug in tls_connection_receive_preallocated.

If the length of the provided preallocated buffer was larger than the length of the packet, we would set length to the length of the buffer, and crash during memcpy. Fix this.

While we are at it, clarify the name of the variable Llength (this variable name should have been cleaned up before PR-ing).

hlef commented 7 months ago

Thanks @davidchisnall for the comments, fixed!

hlef commented 7 months ago

Never mind, there is a small issue.

EDIT: fixed, a cast was missing.