[tor-commits] [tor/master] Add new state to connection_proxy_state_to_string()

nickm at torproject.org nickm at torproject.org
Tue Jan 7 13:10:21 UTC 2020


commit f2aeaaf71d2074019a7f50185f78a36dfb18b9e5
Author: Nick Mathewson <nickm at torproject.org>
Date:   Tue Jan 7 08:09:27 2020 -0500

    Add new state to connection_proxy_state_to_string()
    
    Also, add a CTASSERT() to make sure that we don't let this array get
    out-of-sync again.
    
    Found by coverity; this is CID 1457528.
---
 src/core/mainloop/connection.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/src/core/mainloop/connection.c b/src/core/mainloop/connection.c
index 15b025803..6958d2085 100644
--- a/src/core/mainloop/connection.c
+++ b/src/core/mainloop/connection.c
@@ -107,6 +107,7 @@
 #include "lib/crypt_ops/crypto_util.h"
 #include "lib/geoip/geoip.h"
 
+#include "lib/cc/ctassert.h"
 #include "lib/sandbox/sandbox.h"
 #include "lib/net/buffers_net.h"
 #include "lib/tls/tortls.h"
@@ -2284,9 +2285,12 @@ connection_proxy_state_to_string(int state)
     "PROXY_SOCKS5_WANT_AUTH_METHOD_RFC1929",
     "PROXY_SOCKS5_WANT_AUTH_RFC1929_OK",
     "PROXY_SOCKS5_WANT_CONNECT_OK",
+    "PROXY_HAPROXY_WAIT_FOR_FLUSH",
     "PROXY_CONNECTED",
   };
 
+  CTASSERT(ARRAY_LENGTH(states) == PROXY_CONNECTED+1);
+
   if (state < PROXY_NONE || state > PROXY_CONNECTED)
     return unknown;
 



More information about the tor-commits mailing list