Module: kamailio Branch: master Commit: 807160c199820f3e5df2c1d3f3abe92be3a7c042 URL: https://github.com/kamailio/kamailio/commit/807160c199820f3e5df2c1d3f3abe92b...
Author: jaybeepee jason.penton@gmail.com Committer: jaybeepee jason.penton@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/807160c199820f3e5df2c1d3f3abe92b... Patch: https://github.com/kamailio/kamailio/commit/807160c199820f3e5df2c1d3f3abe92b...
---
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) {