[tor-commits] [obfsproxy/master] Fix a crash when starting in socks mode.

nickm at torproject.org nickm at torproject.org
Wed Jun 1 16:02:51 UTC 2011


commit b1e2ee5f84366034edea3cdc04092d6bab92a809
Author: Nick Mathewson <nickm at torproject.org>
Date:   Wed Jun 1 12:02:44 2011 -0400

    Fix a crash when starting in socks mode.
---
 src/main.c |   10 +++++++---
 1 files changed, 7 insertions(+), 3 deletions(-)

diff --git a/src/main.c b/src/main.c
index 8af4934..de63882 100644
--- a/src/main.c
+++ b/src/main.c
@@ -86,9 +86,13 @@ main(int argc, const char **argv)
   /* figure out what place to connect to as a client/server. */
   /* XXXX when we add socks support, clients will not have a fixed "target"
    * XXXX address but will instead connect to a client-selected address. */
-  if (resolve_address_port(argv[4], 1, 0, &ss_target, &sl_target, NULL) < 0)
-    usage();
-  sa_target = (struct sockaddr *)&ss_target;
+  if (mode != LSN_SOCKS_CLIENT) {
+    if (argc < 5)
+      usage();
+    if (resolve_address_port(argv[4], 1, 0, &ss_target, &sl_target, NULL) < 0)
+      usage();
+    sa_target = (struct sockaddr *)&ss_target;
+  }
 
   /* Let's see if the user wants a shared secret. 
      So ugly. So ugly. So ugly. So ugly. So ugly interface.



More information about the tor-commits mailing list