aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2013-01-15 16:30:26 -0500
committerNick Mathewson <nickm@torproject.org>2013-01-15 16:30:26 -0500
commit938cb6a55e05751a30e50f744bc568b27812a344 (patch)
tree50a9b1b37f0b02ce8bfaf2befbc2b995113a6781 /src
parentc134bb5a8d10d0f422b790ce8b587cf7188aa57e (diff)
parentae15b55173abff1175e0f56759abd29e2870b16c (diff)
downloadtor-938cb6a55e05751a30e50f744bc568b27812a344.tar
tor-938cb6a55e05751a30e50f744bc568b27812a344.tar.gz
Merge remote-tracking branch 'origin/maint-0.2.3'
Diffstat (limited to 'src')
-rw-r--r--src/or/command.c8
-rw-r--r--src/or/relay.c17
2 files changed, 25 insertions, 0 deletions
diff --git a/src/or/command.c b/src/or/command.c
index 7d1f53a87..ec97a78bb 100644
--- a/src/or/command.c
+++ b/src/or/command.c
@@ -221,6 +221,14 @@ command_process_create_cell(cell_t *cell, channel_t *chan)
return;
}
+ if (cell->circ_id == 0) {
+ log_fn(LOG_PROTOCOL_WARN, LD_PROTOCOL,
+ "Received a create cell (type %d) from %s:%d with zero circID; "
+ " ignoring.", (int)cell->command, conn->_base.address,
+ conn->_base.port);
+ return;
+ }
+
/* If the high bit of the circuit ID is not as expected, close the
* circ. */
id_is_high = cell->circ_id & (1<<15);
diff --git a/src/or/relay.c b/src/or/relay.c
index a942e4465..816a4ecc1 100644
--- a/src/or/relay.c
+++ b/src/or/relay.c
@@ -1176,6 +1176,23 @@ connection_edge_process_relay_cell(cell_t *cell, circuit_t *circ,
return - END_CIRC_REASON_TORPROTOCOL;
}
+ if (rh.stream_id == 0) {
+ switch (rh.command) {
+ case RELAY_COMMAND_BEGIN:
+ case RELAY_COMMAND_CONNECTED:
+ case RELAY_COMMAND_DATA:
+ case RELAY_COMMAND_END:
+ case RELAY_COMMAND_RESOLVE:
+ case RELAY_COMMAND_RESOLVED:
+ case RELAY_COMMAND_BEGIN_DIR:
+ log_fn(LOG_PROTOCOL_WARN, LD_PROTOCOL, "Relay command %d with zero "
+ "stream_id. Dropping.", (int)rh.command);
+ return 0;
+ default:
+ ;
+ }
+ }
+
/* either conn is NULL, in which case we've got a control cell, or else
* conn points to the recognized stream. */