[or-cvs] r18102: {tor} make an assert tighter and replace another with an if. (tor/trunk/src/or)
nickm at seul.org
nickm at seul.org
Wed Jan 14 06:36:33 UTC 2009
Author: nickm
Date: 2009-01-14 01:36:33 -0500 (Wed, 14 Jan 2009)
New Revision: 18102
Modified:
tor/trunk/src/or/connection_edge.c
Log:
make an assert tighter and replace another with an if.
Modified: tor/trunk/src/or/connection_edge.c
===================================================================
--- tor/trunk/src/or/connection_edge.c 2009-01-14 06:36:30 UTC (rev 18101)
+++ tor/trunk/src/or/connection_edge.c 2009-01-14 06:36:33 UTC (rev 18102)
@@ -2137,6 +2137,7 @@
ap_conn->stream_id = get_unique_stream_id_by_circ(circ);
if (ap_conn->stream_id==0) {
connection_mark_unattached_ap(ap_conn, END_STREAM_REASON_INTERNAL);
+ /*XXXX022 _close_ the circuit because it's full? That sounds dumb. */
circuit_mark_for_close(TO_CIRCUIT(circ), END_CIRC_REASON_RESOURCELIMIT);
return -1;
}
@@ -2144,7 +2145,6 @@
if (command == SOCKS_COMMAND_RESOLVE) {
string_addr = ap_conn->socks_request->address;
payload_len = (int)strlen(string_addr)+1;
- tor_assert(payload_len <= RELAY_PAYLOAD_SIZE);
} else {
/* command == SOCKS_COMMAND_RESOLVE_PTR */
const char *a = ap_conn->socks_request->address;
@@ -2171,9 +2171,15 @@
string_addr = inaddr_buf;
payload_len = (int)strlen(inaddr_buf)+1;
- tor_assert(payload_len <= RELAY_PAYLOAD_SIZE);
+ tor_assert(payload_len <= (int)sizeof(inaddr_buf));
}
+ if (payload_len > RELAY_PAYLOAD_SIZE) {
+ /* This should be impossible: we don't accept addresses this big. */
+ connection_mark_unattached_ap(ap_conn, END_STREAM_REASON_INTERNAL);
+ return -1;
+ }
+
log_debug(LD_APP,
"Sending relay cell to begin stream %d.", ap_conn->stream_id);
More information about the tor-commits
mailing list