aws / s2n-tls

An implementation of the TLS/SSL protocols
https://aws.github.io/s2n-tls/usage-guide/
Apache License 2.0
4.53k stars 707 forks source link

setsockopt return value is not checked #4799

Open WesleyRosenblum opened 1 month ago

WesleyRosenblum commented 1 month ago

Problem:

The return value of setsockopt is not checked in several places in s2n_socket.c, for example: https://github.com/aws/s2n-tls/blob/main/utils/s2n_socket.c#L123

Some of the uses of setsockopt have the comment /* Ignore the return value, if it fails it fails */, but others do not, so its not clear if it was intentional.

Solution:

Either check the return value, or add a comment

Requirements / Acceptance Criteria:

Uses of setsockopt either check the return value or have a comment explaining why it is not checked