summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorNeels Hofmeyr <neels@hofmeyr.de>2019-04-03 18:15:36 +0200
committerNeels Hofmeyr <nhofmeyr@sysmocom.de>2019-04-11 05:36:36 +0000
commit04cb09cbf1b2f6f496e3474a87f15f905964f090 (patch)
treea90810d3903390e8fc902349147b2b1f4aa9a436 /src
parentd28aa0c2f1fc8827ee7f6958ab8d13630b9d2be9 (diff)
make osmo_sockaddr_str_is_set() NULL-safe
Obviously a NULL pointer should return false instead of segfaulting. Change-Id: Iac025cf4d556cbed99f3924cd9ca05a05881cd9a
Diffstat (limited to 'src')
-rw-r--r--src/sockaddr_str.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/sockaddr_str.c b/src/sockaddr_str.c
index c9d9a946..d683c7d2 100644
--- a/src/sockaddr_str.c
+++ b/src/sockaddr_str.c
@@ -60,7 +60,8 @@
*/
bool osmo_sockaddr_str_is_set(const struct osmo_sockaddr_str *sockaddr_str)
{
- return *sockaddr_str->ip
+ return sockaddr_str
+ && *sockaddr_str->ip
&& sockaddr_str->port
&& (sockaddr_str->af == AF_INET || sockaddr_str->af == AF_INET6);
}