[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[tor-commits] [obfsproxy/master] Avoid segfault on resolve_address_port(NULL)



commit f9d55f065c0348f8f39a96a4844184928ec7019a
Author: Nick Mathewson <nickm@xxxxxxxxxxxxxx>
Date:   Wed Feb 15 12:22:52 2012 -0500

    Avoid segfault on resolve_address_port(NULL)
---
 src/util.c |    7 ++++++-
 1 files changed, 6 insertions(+), 1 deletions(-)

diff --git a/src/util.c b/src/util.c
index b820981..e7ba9c3 100644
--- a/src/util.c
+++ b/src/util.c
@@ -169,9 +169,14 @@ resolve_address_port(const char *address, int nodns, int passive,
   struct evutil_addrinfo *ai = NULL;
   struct evutil_addrinfo ai_hints;
   int ai_res, ai_errno;
-  char *a = xstrdup(address), *cp;
+  char *a, *cp;
   const char *portstr;
 
+  if (!address)
+    return NULL;
+
+  a = xstrdup(address);
+
   if ((cp = strchr(a, ':'))) {
     portstr = cp+1;
     *cp = '\0';



_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits