aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJuanJo Ciarlante <jjo@google.com>2009-10-05 14:44:20 +0200
committerJuanJo Ciarlante <juanjosec@gmail.com>2011-03-25 13:30:30 +0100
commit4af2d42d85e619e508645682bef3904f5d6e39af (patch)
treeb7df4d94ba7bda016c40a4a95cb8a7c56eae610d
parent* socket.c: better buf logic in print_sockaddr_ex (diff)
downloadopenvpn-4af2d42d85e619e508645682bef3904f5d6e39af.tar.xz
* fixed segfault for undef address family in print_sockaddr_ex (thanks Marcel!)
Diffstat (limited to '')
-rw-r--r--socket.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/socket.c b/socket.c
index 943cb58..52b7b68 100644
--- a/socket.c
+++ b/socket.c
@@ -2384,10 +2384,10 @@ print_sockaddr_ex (const struct openvpn_sockaddr *addr,
{
struct buffer out = alloc_buf_gc (128, gc);
bool addr_is_defined;
- if (!addr) {
- return "[NULL]";
+ addr_is_defined = addr_defined (addr);
+ if (!addr_is_defined) {
+ return "[undef]";
}
- addr_is_defined = addr_defined (addr);
#ifdef USE_PF_INET6
switch(addr->addr.sa.sa_family)
{
@@ -2414,7 +2414,7 @@ print_sockaddr_ex (const struct openvpn_sockaddr *addr,
case AF_INET6:
{
const int port= ntohs (addr->addr.in6.sin6_port);
- char buf[INET6_ADDRSTRLEN] = "[undef]";
+ char buf[INET6_ADDRSTRLEN] = "";
buf_puts (&out, "[AF_INET6]");
if (addr_is_defined)
{