Change in libosmocore[master]: make osmo_sockaddr_str_is_set() NULL-safe

Neels Hofmeyr gerrit-no-reply at lists.osmocom.org
Wed Apr 10 17:50:44 UTC 2019


Neels Hofmeyr has uploaded this change for review. ( https://gerrit.osmocom.org/13572


Change subject: make osmo_sockaddr_str_is_set() NULL-safe
......................................................................

make osmo_sockaddr_str_is_set() NULL-safe

Obviously a NULL pointer should return false instead of segfaulting.

Change-Id: Iac025cf4d556cbed99f3924cd9ca05a05881cd9a
---
M src/sockaddr_str.c
1 file changed, 2 insertions(+), 1 deletion(-)



  git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/72/13572/1

diff --git a/src/sockaddr_str.c b/src/sockaddr_str.c
index c9d9a94..d683c7d 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);
 }

-- 
To view, visit https://gerrit.osmocom.org/13572
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings

Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-MessageType: newchange
Gerrit-Change-Id: Iac025cf4d556cbed99f3924cd9ca05a05881cd9a
Gerrit-Change-Number: 13572
Gerrit-PatchSet: 1
Gerrit-Owner: Neels Hofmeyr <nhofmeyr at sysmocom.de>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20190410/789e1558/attachment.html>


More information about the gerrit-log mailing list