[or-cvs] Fix a segfault
Nick Mathewson
nickm at seul.org
Wed May 11 04:14:20 UTC 2005
Update of /home/or/cvsroot/tor/src/or
In directory moria.mit.edu:/tmp/cvs-serv26939/src/or
Modified Files:
connection_edge.c
Log Message:
Fix a segfault
Index: connection_edge.c
===================================================================
RCS file: /home/or/cvsroot/tor/src/or/connection_edge.c,v
retrieving revision 1.325
retrieving revision 1.326
diff -u -d -r1.325 -r1.326
--- connection_edge.c 10 May 2005 22:12:48 -0000 1.325
+++ connection_edge.c 11 May 2005 04:14:17 -0000 1.326
@@ -915,16 +915,17 @@
/* 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) {
More information about the tor-commits
mailing list