-
Notifications
You must be signed in to change notification settings - Fork 8.2k
Closed
Labels
area: NetworkingbugThe issue is a bug, or the PR is fixing a bugThe issue is a bug, or the PR is fixing a bugpriority: mediumMedium impact/importance bugMedium impact/importance bug
Milestone
Description
I encountered a scenario where TLS handshake got broken. The mbedtls stack discarded tls records assuming corrupt data.
Digging further, I found that the way the incoming TLS records have been fed to mbedtls stack is wrong. Specifically, in function tcp_rx() (inside mbedtls_sslclient/src/tcp.c), the function always copies 'read_bytes' of data in input buffer 'buf' even if the requested input len given in 'size' parameter is less than 'read_bytes'. This could cause buffer overflow. Further, mbedtls stack disards whatever extra (i.e. read_bytes - size) that has been copied in tcp_rx() in 'buf'.
Perhaps, it would have been simpler and user-friendly, if instead of net_context apis, POSIX style sockets had been used in this example.
Metadata
Metadata
Assignees
Labels
area: NetworkingbugThe issue is a bug, or the PR is fixing a bugThe issue is a bug, or the PR is fixing a bugpriority: mediumMedium impact/importance bugMedium impact/importance bug