[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[tor-commits] [tor/master] Use the correct macro to detect an invalid socket in tortls_nss.c



commit d6c564e09ab491765b6773cc45320bc0f605fcfe
Author: Nick Mathewson <nickm@xxxxxxxxxxxxxx>
Date:   Thu Sep 20 12:55:31 2018 -0400

    Use the correct macro to detect an invalid socket in tortls_nss.c
    
    Fixes bug 27782; bugfix on 0.3.5.1-alpha
---
 changes/bug27782         | 4 ++++
 src/lib/tls/tortls_nss.c | 2 +-
 2 files changed, 5 insertions(+), 1 deletion(-)

diff --git a/changes/bug27782 b/changes/bug27782
new file mode 100644
index 000000000..3564c34b6
--- /dev/null
+++ b/changes/bug27782
@@ -0,0 +1,4 @@
+  o Minor bugfixes (NSS):
+    - Correctly detect failure to open a dummy TCP socket when
+      stealing ownership of an fd from the NSS layer. Fixes bug 27782;
+      bugfix on 0.3.5.1-alpha.
diff --git a/src/lib/tls/tortls_nss.c b/src/lib/tls/tortls_nss.c
index 4e7227b12..e1e6cc501 100644
--- a/src/lib/tls/tortls_nss.c
+++ b/src/lib/tls/tortls_nss.c
@@ -444,7 +444,7 @@ tor_tls_release_socket(tor_tls_t *tls)
    */
   tor_socket_t sock =
     tor_open_socket_nonblocking(AF_INET, SOCK_STREAM, IPPROTO_TCP);
-  if (!sock) {
+  if (! SOCKET_OK(sock)) {
     log_warn(LD_NET, "Out of sockets when trying to shut down an NSS "
              "connection");
     return;



_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits