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

[tor-commits] [tor/main] nss: Don't write empty payload on the wire



commit 9bf4a9e18a244dd9930a906e92d1f33bbc3bbf13
Author: David Goulet <dgoulet@xxxxxxxxxxxxxx>
Date:   Tue Feb 8 09:30:50 2022 -0500

    nss: Don't write empty payload on the wire
    
    Part of #40548
    
    Signed-off-by: David Goulet <dgoulet@xxxxxxxxxxxxxx>
---
 src/lib/tls/tortls_nss.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/src/lib/tls/tortls_nss.c b/src/lib/tls/tortls_nss.c
index b1007c6218..392747e930 100644
--- a/src/lib/tls/tortls_nss.c
+++ b/src/lib/tls/tortls_nss.c
@@ -588,6 +588,10 @@ tor_tls_write(tor_tls_t *tls, const char *cp, size_t n)
   tor_assert(cp || n == 0);
   tor_assert(n < INT_MAX);
 
+  if (n == 0) {
+    return 0;
+  }
+
   PRInt32 rv = PR_Write(tls->ssl, cp, (int)n);
   // log_debug(LD_NET, "PR_Write(%zu) returned %d", n, (int)rv);
   if (rv > 0) {



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