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

Neels Hofmeyr gerrit-no-reply at lists.osmocom.org
Thu Apr 11 05:36:40 UTC 2019


Neels Hofmeyr has submitted this change and it was merged. ( 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(-)

Approvals:
  Harald Welte: Looks good to me, approved
  Jenkins Builder: Verified



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: merged
Gerrit-Change-Id: Iac025cf4d556cbed99f3924cd9ca05a05881cd9a
Gerrit-Change-Number: 13572
Gerrit-PatchSet: 2
Gerrit-Owner: Neels Hofmeyr <nhofmeyr at sysmocom.de>
Gerrit-Reviewer: Harald Welte <laforge at gnumonks.org>
Gerrit-Reviewer: Jenkins Builder (1000002)
Gerrit-Reviewer: Neels Hofmeyr <nhofmeyr at sysmocom.de>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20190411/62ad4af9/attachment.html>


More information about the gerrit-log mailing list