From 5bed496e33325c1df3d8b48d57fd1ea032b9a773 Mon Sep 17 00:00:00 2001 From: Matthias Wachs Date: Tue, 20 Aug 2013 11:15:13 +0000 Subject: [PATCH] fixing bugs found by clang --- src/transport/plugin_transport_udp.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/transport/plugin_transport_udp.c b/src/transport/plugin_transport_udp.c index 90053b575..0f76a6842 100644 --- a/src/transport/plugin_transport_udp.c +++ b/src/transport/plugin_transport_udp.c @@ -559,7 +559,7 @@ udp_address_to_string (void *cls, const void *addr, size_t addrlen) uint16_t port; uint32_t options; - if (addrlen == sizeof (struct IPv6UdpAddress)) + if ((NULL != addr) && (addrlen == sizeof (struct IPv6UdpAddress))) { t6 = addr; af = AF_INET6; @@ -568,7 +568,7 @@ udp_address_to_string (void *cls, const void *addr, size_t addrlen) memcpy (&a6, &t6->ipv6_addr, sizeof (a6)); sb = &a6; } - else if (addrlen == sizeof (struct IPv4UdpAddress)) + else if ((NULL != addr) && (addrlen == sizeof (struct IPv4UdpAddress))) { t4 = addr; af = AF_INET; @@ -1392,6 +1392,12 @@ create_session (struct Plugin *plugin, const struct GNUNET_PeerIdentity *target, struct sockaddr_in6 *v6; size_t len; + if (NULL == addr) + { + GNUNET_break (0); + return NULL; + } + switch (addrlen) { case sizeof (struct IPv4UdpAddress): -- 2.25.1