Module: sip-router
Branch: master
Commit: b0e9132ccd1e8385b8b4faf72db806320d48e2f5
URL:
http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=b0e9132…
Author: Daniel-Constantin Mierla <miconda(a)gmail.com>
Committer: Daniel-Constantin Mierla <miconda(a)gmail.com>
Date: Tue Aug 13 09:37:21 2013 +0200
usrloc: safety checks to catch empty ruid
---
modules/usrloc/ucontact.c | 10 ++++++++++
1 files changed, 10 insertions(+), 0 deletions(-)
diff --git a/modules/usrloc/ucontact.c b/modules/usrloc/ucontact.c
index c8da8ec..d1ae1f3 100644
--- a/modules/usrloc/ucontact.c
+++ b/modules/usrloc/ucontact.c
@@ -93,6 +93,11 @@ ucontact_t* new_ucontact(str* _dom, str* _aor, str* _contact,
ucontact_info_t* _
{
ucontact_t *c;
+ if(unlikely(_ci->ruid.len<=0)) {
+ LM_ERR("no ruid for aor: %.*s\n", _aor->len, ZSW(_aor->s));
+ return 0;
+ }
+
c = (ucontact_t*)shm_malloc(sizeof(ucontact_t));
if (!c) {
LM_ERR("no more shm memory\n");
@@ -465,6 +470,11 @@ int db_insert_ucontact(ucontact_t* _c)
if (_c->flags & FL_MEM) {
return 0;
}
+ if(unlikely(_c->ruid.len<=0)) {
+ LM_ERR("invalid ruid for aor: %.*s\n",
+ _c->aor->len, ZSW(_c->aor->s));
+ return -1;
+ }
keys[0] = &user_col;
keys[1] = &contact_col;