diff options
author | David Goulet <dgoulet@torproject.org> | 2023-11-08 11:17:48 -0500 |
---|---|---|
committer | David Goulet <dgoulet@torproject.org> | 2023-11-08 11:17:48 -0500 |
commit | 83aecca561e5c284a7279e1fc5784871abe5304b (patch) | |
tree | 3e7872515bf284b4ee35fb9e7c2bbdfeb9443155 | |
parent | e62b8bce5a88f8fa38a62ab503df7f0eecfb1d22 (diff) | |
download | tor-83aecca561e5c284a7279e1fc5784871abe5304b.tar.gz tor-83aecca561e5c284a7279e1fc5784871abe5304b.zip |
hs: Always check if the hs_ident is available when processing a cell
Signed-off-by: David Goulet <dgoulet@torproject.org>
-rw-r--r-- | src/feature/rend/rendcommon.c | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/src/feature/rend/rendcommon.c b/src/feature/rend/rendcommon.c index 0628422812..5a9689e7bc 100644 --- a/src/feature/rend/rendcommon.c +++ b/src/feature/rend/rendcommon.c @@ -40,7 +40,14 @@ rend_process_relay_cell(circuit_t *circ, const crypt_path_t *layer_hint, int r = -2; if (CIRCUIT_IS_ORIGIN(circ)) { origin_circ = TO_ORIGIN_CIRCUIT(circ); - if (!layer_hint || layer_hint != origin_circ->cpath->prev) { + + /* Opened onion service circuit receiving cell MUST have an hs_ident as it + * is the underlying assumption else we can't process the cell. If this is + * the case, we can't recover so close the circuit. */ + if (BUG(!origin_circ->hs_ident)) { + circuit_mark_for_close(circ, END_CIRC_REASON_INTERNAL); + origin_circ = NULL; + } else if (!layer_hint || layer_hint != origin_circ->cpath->prev) { log_fn(LOG_PROTOCOL_WARN, LD_APP, "Relay cell (rend purpose %d) from wrong hop on origin circ", command); |