Skip to content

Commit

Permalink
Add new state to connection_proxy_state_to_string()
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
nmathewson committed Jan 7, 2020
1 parent 1b63eea commit f2aeaaf
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/core/mainloop/connection.c
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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;

Expand Down

0 comments on commit f2aeaaf

Please sign in to comment.