aboutsummaryrefslogtreecommitdiff
path: root/src/lib/tls
diff options
context:
space:
mode:
authorDavid Goulet <dgoulet@torproject.org>2022-02-08 09:30:50 -0500
committerDavid Goulet <dgoulet@torproject.org>2022-02-08 09:31:13 -0500
commit9bf4a9e18a244dd9930a906e92d1f33bbc3bbf13 (patch)
tree4550b5119180346fbc5d2f3664db003956e7fe3b /src/lib/tls
parent9e86491cf861ac1beb9b92bc231f049415b8ed69 (diff)
downloadtor-9bf4a9e18a244dd9930a906e92d1f33bbc3bbf13.tar.gz
tor-9bf4a9e18a244dd9930a906e92d1f33bbc3bbf13.zip
nss: Don't write empty payload on the wire
Part of #40548 Signed-off-by: David Goulet <dgoulet@torproject.org>
Diffstat (limited to 'src/lib/tls')
-rw-r--r--src/lib/tls/tortls_nss.c4
1 files changed, 4 insertions, 0 deletions
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) {