Change in osmo-hlr[master]: make osmo_cni_peer_id_cmp() NULL safe

This is merely a historical archive of years 2008-2021, before the migration to mailman3.

A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/gerrit-log@lists.osmocom.org/.

neels gerrit-no-reply at lists.osmocom.org
Tue May 5 00:03:26 UTC 2020


neels has uploaded this change for review. ( https://gerrit.osmocom.org/c/osmo-hlr/+/18037 )


Change subject: make osmo_cni_peer_id_cmp() NULL safe
......................................................................

make osmo_cni_peer_id_cmp() NULL safe

Related: coverity CID#210172
Change-Id: I400b23ac3f0eb68d5e4c757ea02d130fbe12f80b
---
M src/gsupclient/cni_peer_id.c
1 file changed, 6 insertions(+), 0 deletions(-)



  git pull ssh://gerrit.osmocom.org:29418/osmo-hlr refs/changes/37/18037/1

diff --git a/src/gsupclient/cni_peer_id.c b/src/gsupclient/cni_peer_id.c
index de7b4bc..ab36959 100644
--- a/src/gsupclient/cni_peer_id.c
+++ b/src/gsupclient/cni_peer_id.c
@@ -154,6 +154,12 @@
 
 int osmo_cni_peer_id_cmp(const struct osmo_cni_peer_id *a, const struct osmo_cni_peer_id *b)
 {
+	if (a == b)
+		return 0;
+	if (!a)
+		return -1;
+	if (!b)
+		return 1;
 	if (a->type != b->type)
 		return OSMO_CMP(a->type, b->type);
 	switch (a->type) {

-- 
To view, visit https://gerrit.osmocom.org/c/osmo-hlr/+/18037
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-hlr
Gerrit-Branch: master
Gerrit-Change-Id: I400b23ac3f0eb68d5e4c757ea02d130fbe12f80b
Gerrit-Change-Number: 18037
Gerrit-PatchSet: 1
Gerrit-Owner: neels <nhofmeyr at sysmocom.de>
Gerrit-MessageType: newchange
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20200505/076bc454/attachment.htm>


More information about the gerrit-log mailing list