[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
[tor-commits] [tor/master] Fix coverity warnings 1472846 / 1472845.
commit b64fe4bf55e57c19bb0ade5fc08d6500ac561019
Author: George Kadianakis <desnacked@xxxxxxxxxx>
Date: Tue Feb 9 18:50:20 2021 +0200
Fix coverity warnings 1472846 / 1472845.
---
src/core/or/circuituse.c | 9 ++++++---
src/core/or/connection_edge.c | 6 ++++--
2 files changed, 10 insertions(+), 5 deletions(-)
diff --git a/src/core/or/circuituse.c b/src/core/or/circuituse.c
index 018654769d..11ba059b0e 100644
--- a/src/core/or/circuituse.c
+++ b/src/core/or/circuituse.c
@@ -2735,10 +2735,12 @@ consider_recording_trackhost(const entry_connection_t *conn,
char fp[HEX_DIGEST_LEN+1];
uint64_t stream_id = 0;
- if (conn) {
- stream_id = ENTRY_TO_CONN(conn)->global_identifier;
+ if (BUG(!conn)) {
+ return;
}
+ stream_id = ENTRY_TO_CONN(conn)->global_identifier;
+
/* Search the addressmap for this conn's destination. */
/* If they're not in the address map.. */
if (!options->TrackHostExits ||
@@ -2801,8 +2803,9 @@ connection_ap_handshake_attach_chosen_circuit(entry_connection_t *conn,
tor_assert(conn->socks_request);
if (conn->socks_request->command == SOCKS_COMMAND_CONNECT) {
- if (!conn->use_begindir)
+ if (!conn->use_begindir) {
consider_recording_trackhost(conn, circ);
+ }
if (connection_ap_handshake_send_begin(conn) < 0)
return -1;
} else {
diff --git a/src/core/or/connection_edge.c b/src/core/or/connection_edge.c
index b212160f60..aa48d16b7c 100644
--- a/src/core/or/connection_edge.c
+++ b/src/core/or/connection_edge.c
@@ -3521,10 +3521,12 @@ tell_controller_about_resolved_result(entry_connection_t *conn,
{
uint64_t stream_id = 0;
- if (conn) {
- stream_id = ENTRY_TO_CONN(conn)->global_identifier;
+ if (BUG(!conn)) {
+ return;
}
+ stream_id = ENTRY_TO_CONN(conn)->global_identifier;
+
expires = time(NULL) + ttl;
if (answer_type == RESOLVED_TYPE_IPV4 && answer_len >= 4) {
char *cp = tor_dup_ip(ntohl(get_uint32(answer)));
_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits