[tor-commits] [obfsproxy/master] Avoid segfault on resolve_address_port(NULL)
asn at torproject.org
asn at torproject.org
Tue Apr 17 13:51:29 UTC 2012
commit f9d55f065c0348f8f39a96a4844184928ec7019a
Author: Nick Mathewson <nickm at torproject.org>
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';
More information about the tor-commits
mailing list