summaryrefslogtreecommitdiff
path: root/src/or/connection_edge.c
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2005-05-11 04:14:17 +0000
committerNick Mathewson <nickm@torproject.org>2005-05-11 04:14:17 +0000
commit776b411dc9390fa86185066ed63660c4c7a2e3f8 (patch)
treeeb3fd994a3a54d554ea8be66af6968317ef5c50e /src/or/connection_edge.c
parentdcc1b8a8389ca967d0b5f14c37a1277cb7efcbc7 (diff)
downloadtor-776b411dc9390fa86185066ed63660c4c7a2e3f8.tar.gz
tor-776b411dc9390fa86185066ed63660c4c7a2e3f8.zip
Fix a segfault
svn:r4191
Diffstat (limited to 'src/or/connection_edge.c')
-rw-r--r--src/or/connection_edge.c19
1 files changed, 10 insertions, 9 deletions
diff --git a/src/or/connection_edge.c b/src/or/connection_edge.c
index d49e68931d..adcaa64578 100644
--- a/src/or/connection_edge.c
+++ b/src/or/connection_edge.c
@@ -915,16 +915,17 @@ static int connection_ap_handshake_process_socks(connection_t *conn) {
/* foo.exit -- modify conn->chosen_exit_node to specify the exit
* node, and conn->address to hold only the address portion.*/
char *s = strrchr(socks->address,'.');
- if (s && s[1] != '\0') {
- conn->chosen_exit_name = tor_strdup(s+1);
- *s = 0;
- } else if (s[1] == '\0') {
- log_fn(LOG_WARN,"Malformed exit address '%s.exit'. Refusing.",
- safe_str(socks->address));
- connection_mark_unattached_ap(conn, END_STREAM_REASON_TORPROTOCOL);
- return -1;
+ if (s) {
+ if (s[1] != '\0') {
+ conn->chosen_exit_name = tor_strdup(s+1);
+ *s = 0;
+ } else {
+ log_fn(LOG_WARN,"Malformed exit address '%s.exit'. Refusing.",
+ safe_str(socks->address));
+ connection_mark_unattached_ap(conn, END_STREAM_REASON_TORPROTOCOL);
+ return -1;
+ }
} else {
- tor_assert(!s); /* address is of the form server.exit. */
struct in_addr in;
routerinfo_t *r = router_get_by_nickname(socks->address);
if (r) {