Module: sip-router
Branch: 3.3
Commit: 353865830cca632d374f821687de6ba33bf61450
URL:
http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=3538658…
Author: Daniel-Constantin Mierla <miconda(a)gmail.com>
Committer: Daniel-Constantin Mierla <miconda(a)gmail.com>
Date: Mon Jun 11 14:32:44 2012 +0200
registrar(k): don't access realm_prefix.s if len is <=0
- solaris is not happy accessing .s struct field if set to 0
(cherry picked from commit 0c7b9304efd5954cf53ba13a065b05a277efc91f)
---
modules_k/registrar/common.c | 10 ++++++----
1 files changed, 6 insertions(+), 4 deletions(-)
diff --git a/modules_k/registrar/common.c b/modules_k/registrar/common.c
index c682f15..7cb179f 100644
--- a/modules_k/registrar/common.c
+++ b/modules_k/registrar/common.c
@@ -54,7 +54,7 @@ int extract_aor(str* _uri, str* _a, sip_uri_t *_pu)
sip_uri_t *puri;
int user_len;
str *uri;
- str realm_prefix;
+ str realm_prefix = {0};
memset(aor_buf, 0, MAX_AOR_LEN);
uri=_uri;
@@ -93,10 +93,12 @@ int extract_aor(str* _uri, str* _a, sip_uri_t *_pu)
if (user_len)
aor_buf[_a->len++] = '@';
/* strip prefix (if defined) */
- realm_prefix.s = cfg_get(registrar, registrar_cfg, realm_pref).s;
realm_prefix.len = cfg_get(registrar, registrar_cfg, realm_pref).len;
- LM_DBG("realm prefix is [%.*s]\n", realm_prefix.len,
- (realm_prefix.len>0)?realm_prefix.s:"");
+ if(realm_prefix.len>0) {
+ realm_prefix.s = cfg_get(registrar, registrar_cfg, realm_pref).s;
+ LM_DBG("realm prefix is [%.*s]\n", realm_prefix.len,
+ (realm_prefix.len>0)?realm_prefix.s:"");
+ }
if (realm_prefix.len>0
&& realm_prefix.len<puri->host.len
&& (memcmp(realm_prefix.s, puri->host.s, realm_prefix.len)==0))