[sr-dev] git:master:807160c1: lib/ims: fixed possible crash when trying to get IMPI without realm

jaybeepee jason.penton at gmail.com
Mon Nov 2 17:56:22 CET 2015


Module: kamailio
Branch: master
Commit: 807160c199820f3e5df2c1d3f3abe92be3a7c042
URL: https://github.com/kamailio/kamailio/commit/807160c199820f3e5df2c1d3f3abe92be3a7c042

Author: jaybeepee <jason.penton at gmail.com>
Committer: jaybeepee <jason.penton at gmail.com>
Date: 2015-11-02T18:55:09+02:00

lib/ims: fixed possible crash when trying to get IMPI without realm

---

Modified: lib/ims/ims_getters.c

---

Diff:  https://github.com/kamailio/kamailio/commit/807160c199820f3e5df2c1d3f3abe92be3a7c042.diff
Patch: https://github.com/kamailio/kamailio/commit/807160c199820f3e5df2c1d3f3abe92be3a7c042.patch

---

diff --git a/lib/ims/ims_getters.c b/lib/ims/ims_getters.c
index 37cb411..5765ba9 100644
--- a/lib/ims/ims_getters.c
+++ b/lib/ims/ims_getters.c
@@ -122,6 +122,15 @@ str cscf_get_private_identity(struct sip_msg *msg, str realm) {
 	struct hdr_field* h = 0;
 	int ret, i, res;
 
+	if ((parse_headers(msg, HDR_AUTHORIZATION_F, 0) != 0) && (parse_headers(msg, HDR_PROXYAUTH_F, 0) != 0)) {
+		return pi;
+	}
+
+	h = msg->authorization;
+	if (!msg->authorization) {
+		goto fallback;
+	}
+		
 	if (realm.len && realm.s) {
 		ret = find_credentials(msg, &realm, HDR_AUTHORIZATION_F, &h);
 		if (ret < 0) {
@@ -140,6 +149,9 @@ str cscf_get_private_identity(struct sip_msg *msg, str realm) {
 			}
 		}
 	}
+	
+	if (!h)
+		goto fallback;
 
 	res = parse_credentials(h);
 	if (res != 0) {




More information about the sr-dev mailing list