Module: sip-router
Branch: master
Commit: f97be98d05664e9fef02942103d27e35eb3e1d3c
URL:
http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=f97be98…
Author: Jason Penton <jason.penton(a)gmail.com>
Committer: Jason Penton <jason.penton(a)gmail.com>
Date: Fri Dec 5 10:17:03 2014 +0200
modules/ims_usrloc_scscf: fixed possible crash if out of pkg_mem
---
modules/ims_usrloc_scscf/subscribe.c | 2 +-
modules/ims_usrloc_scscf/udomain.c | 4 ++++
2 files changed, 5 insertions(+), 1 deletions(-)
diff --git a/modules/ims_usrloc_scscf/subscribe.c b/modules/ims_usrloc_scscf/subscribe.c
index 49c8c6c..31766fe 100644
--- a/modules/ims_usrloc_scscf/subscribe.c
+++ b/modules/ims_usrloc_scscf/subscribe.c
@@ -355,7 +355,7 @@ void external_delete_subscriber(reg_subscriber *s, udomain_t* _t, int
lock_domai
}
void delete_subscriber(impurecord_t* urec, reg_subscriber *s) {
- LM_DBG("Deleting subscriber");
+ LM_DBG("Deleting subscriber [%.*s] from IMPU: [%.*s]",
s->watcher_uri.len, s->watcher_uri.s, urec->public_identity.len,
urec->public_identitys);
if (db_mode == WRITE_THROUGH && db_unlink_subscriber_from_impu(urec, s) !=0)
{
LM_ERR("Failed to delete DB linking subscriber [%.*s] to IMPU
[%.*s]...continuing but db will be out of sync!\n",
diff --git a/modules/ims_usrloc_scscf/udomain.c b/modules/ims_usrloc_scscf/udomain.c
index 98ebaac..15bf1c9 100644
--- a/modules/ims_usrloc_scscf/udomain.c
+++ b/modules/ims_usrloc_scscf/udomain.c
@@ -677,6 +677,10 @@ int get_impus_from_subscription_as_string(udomain_t* _d,
impurecord_t* impu_rec,
len = (sizeof (str)*(*num_impus)) + bytes_needed;
*impus = (str*) pkg_malloc(len);
+ if (*impus == 0) {
+ LM_ERR("no more pkg_mem\n");
+ return 0;
+ }
char* ptr = (char*) (*impus + *num_impus);
//now populate the data