]> git.ipfire.org Git - thirdparty/tor.git/commitdiff
Handle TRUNCATE correctly if our next channel isn't done yet.
authorNick Mathewson <nickm@torproject.org>
Mon, 18 Mar 2013 19:55:55 +0000 (15:55 -0400)
committerNick Mathewson <nickm@torproject.org>
Mon, 18 Mar 2013 19:55:55 +0000 (15:55 -0400)
Patch from 'cypherpunks'. Fixes bug #7947. Bugfix on 0.0.7.1.

changes/bug7947 [new file with mode: 0644]
src/or/relay.c

diff --git a/changes/bug7947 b/changes/bug7947
new file mode 100644 (file)
index 0000000..6200ba2
--- /dev/null
@@ -0,0 +1,4 @@
+  o Minor bugfixes:
+    - Fix the handling of a TRUNCATE cell when it arrives while the circuit
+      extension is in progress. Fixes bug 7947; bugfix on 0.0.7.1.
+
index 9ff9e1e1f4dcba9a0789d726c10e61e8f525b9ef..8e80d14a87dfc521c88524e90257bacf776c80c9 100644 (file)
@@ -1398,6 +1398,14 @@ connection_edge_process_relay_cell(cell_t *cell, circuit_t *circ,
                "'truncate' unsupported at origin. Dropping.");
         return 0;
       }
+      if (circ->n_hop) {
+        if (circ->n_chan)
+          log_warn(LD_BUG, "n_chan and n_hop set on the same circuit!");
+        extend_info_free(circ->n_hop);
+        circ->n_hop = NULL;
+        tor_free(circ->n_chan_create_cell);
+        circuit_set_state(circ, CIRCUIT_STATE_OPEN);
+      }
       if (circ->n_chan) {
         uint8_t trunc_reason = get_uint8(cell->payload + RELAY_HEADER_SIZE);
         circuit_clear_cell_queue(circ, circ->n_chan);