]> git.ipfire.org Git - thirdparty/tor.git/commitdiff
hs-v3: Fix NULL deref. in hs_circ_service_get_established_intro_circ()
authorDavid Goulet <dgoulet@torproject.org>
Tue, 3 Dec 2019 15:11:42 +0000 (10:11 -0500)
committerDavid Goulet <dgoulet@torproject.org>
Tue, 3 Dec 2019 15:11:42 +0000 (10:11 -0500)
Found by Stem regression tests. Reported by atagar.

Fixes #32664

Signed-off-by: David Goulet <dgoulet@torproject.org>
src/feature/hs/hs_circuit.c

index a43e7f0e2323acb5d2da4e8406ed66326775b8dd..a09e3197294c2eae41a08d6f71bc24f29eca200a 100644 (file)
@@ -673,7 +673,8 @@ hs_circ_service_get_established_intro_circ(const hs_service_intro_point_t *ip)
   }
 
   /* Only return circuit if it is established. */
-  return (TO_CIRCUIT(circ)->purpose == CIRCUIT_PURPOSE_S_INTRO) ? circ : NULL;
+  return (circ && TO_CIRCUIT(circ)->purpose == CIRCUIT_PURPOSE_S_INTRO) ?
+          circ : NULL;
 }
 
 /** Called when we fail building a rendezvous circuit at some point other than