summaryrefslogtreecommitdiff
path: root/src/or/connection_edge.c
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2005-06-07 18:01:46 +0000
committerNick Mathewson <nickm@torproject.org>2005-06-07 18:01:46 +0000
commit621ab95e59f40119e17f76cfc3587eecceb3784b (patch)
treee17758eafc93704a36aef675b447c65a2c023325 /src/or/connection_edge.c
parent2118e5798acc8b34ff4450c29717722b345a52cb (diff)
downloadtor-621ab95e59f40119e17f76cfc3587eecceb3784b.tar.gz
tor-621ab95e59f40119e17f76cfc3587eecceb3784b.zip
Fix for 152: reject malformed .onion addresses rather then passing them on
svn:r4329
Diffstat (limited to 'src/or/connection_edge.c')
-rw-r--r--src/or/connection_edge.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/or/connection_edge.c b/src/or/connection_edge.c
index 844b6f04c3..c4a01f1392 100644
--- a/src/or/connection_edge.c
+++ b/src/or/connection_edge.c
@@ -911,6 +911,12 @@ static int connection_ap_handshake_process_socks(connection_t *conn) {
*/
addresstype = parse_extended_hostname(socks->address);
+ if (addresstype == BAD_HOSTNAME) {
+ log_fn(LOG_WARN, "Invalid hostname %s; rejecting", socks->address);
+ connection_mark_unattached_ap(conn, END_STREAM_REASON_TORPROTOCOL);
+ return -1;
+ }
+
if (addresstype == EXIT_HOSTNAME) {
/* foo.exit -- modify conn->chosen_exit_node to specify the exit
* node, and conn->address to hold only the address portion.*/
@@ -1712,6 +1718,6 @@ parse_extended_hostname(char *address) {
failed:
/* otherwise, return to previous state and return 0 */
*s = '.';
- return NORMAL_HOSTNAME;
+ return BAD_HOSTNAME;
}