[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
[tor-bugs] #27782 [Core Tor/Tor]: nss: tor_tls_release_socket() won't catch invalid socket value
#27782: nss: tor_tls_release_socket() won't catch invalid socket value
------------------------------+--------------------------------
Reporter: dgoulet | Owner: (none)
Type: defect | Status: new
Priority: Medium | Milestone: Tor: 0.3.5.x-final
Component: Core Tor/Tor | Version:
Severity: Normal | Keywords: tor-nss
Actual Points: | Parent ID:
Points: | Reviewer:
Sponsor: |
------------------------------+--------------------------------
From commit ae5692994fc31cc5fa25fb5681e59e326e6c5dbe:
{{{
+ tor_socket_t sock =
+ tor_open_socket_nonblocking(AF_INET, SOCK_STREAM, IPPROTO_TCP);
+ if (!sock) {
+ log_warn(LD_NET, "Out of sockets when trying to shut down an NSS "
+ "connection");
+ return;
+ }
}}}
A socket value of `0` is a _valid_ socket but not only that, if `socket()`
did ran out of fd, `-1` will be returned (or other errors would send back
`TOR_INVALID_SOCKET = -1`).
So we probably want `if (sock < 0) {}`
--
Ticket URL: <https://trac.torproject.org/projects/tor/ticket/27782>
Tor Bug Tracker & Wiki <https://trac.torproject.org/>
The Tor Project: anonymity online
_______________________________________________
tor-bugs mailing list
tor-bugs@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-bugs