]> git.ipfire.org Git - thirdparty/tor.git/commitdiff
Do not call tor_tls_server_info_callback(NULL) from tests.
authorNick Mathewson <nickm@torproject.org>
Wed, 31 Aug 2016 17:18:13 +0000 (13:18 -0400)
committerNick Mathewson <nickm@torproject.org>
Wed, 31 Aug 2016 17:18:13 +0000 (13:18 -0400)
This isn't valid behavior, and it causes a crash when you run
the unit tests at --debug.

I've added an IF_BUG_ONCE() check for this case.

src/common/tortls.c
src/test/test_tortls.c

index a62efb557512c32b9ae143f3030ef381666a8437..23889be259a0adf824f2d0d8270583d77b6dca71 100644 (file)
@@ -1489,6 +1489,10 @@ tor_tls_server_info_callback(const SSL *ssl, int type, int val)
   tor_tls_t *tls;
   (void) val;
 
+  IF_BUG_ONCE(ssl == NULL) {
+    return; // LCOV_EXCL_LINE
+  }
+
   tor_tls_debug_state_callback(ssl, type, val);
 
   if (type != SSL_CB_ACCEPT_LOOP)
index 3a048fb1f07c5fe54545e26b9b9c0f0ac478396b..9115823f315c887638852eff0011d30ca532e414 100644 (file)
@@ -1831,8 +1831,6 @@ test_tortls_server_info_callback(void *ignored)
   tls->magic = TOR_TLS_MAGIC;
   tls->ssl = ssl;
 
-  tor_tls_server_info_callback(NULL, 0, 0);
-
   SSL_set_state(ssl, SSL3_ST_SW_SRVR_HELLO_A);
   mock_clean_saved_logs();
   tor_tls_server_info_callback(ssl, SSL_CB_ACCEPT_LOOP, 0);