[sr-dev] git:master: registrar(k): don't access realm_prefix.s if len is <=0

Daniel-Constantin Mierla miconda at gmail.com
Mon Jun 11 14:38:14 CEST 2012


Hello,

actually is not completely yet -- I set the realm prefix parameter and 
got another crash. But at least should work when prefix is not set :-)

Cheers,
Daniel

On 6/11/12 2:36 PM, Jason Penton wrote:
> Great find Daniel,
>
> lol, must be a sparc issue - we are running x86 and haven't come 
> across this...... bizarre.
>
> Cheers
> Jason
>
> On Mon, Jun 11, 2012 at 2:34 PM, Daniel-Constantin Mierla 
> <miconda at gmail.com <mailto:miconda at gmail.com>> wrote:
>
>     Module: sip-router
>     Branch: master
>     Commit: 0c7b9304efd5954cf53ba13a065b05a277efc91f
>     URL:
>     http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=0c7b9304efd5954cf53ba13a065b05a277efc91f
>
>     Author: Daniel-Constantin Mierla <miconda at gmail.com
>     <mailto:miconda at gmail.com>>
>     Committer: Daniel-Constantin Mierla <miconda at gmail.com
>     <mailto:miconda at 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
>
>     ---
>
>      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))
>
>
>     _______________________________________________
>     sr-dev mailing list
>     sr-dev at lists.sip-router.org <mailto:sr-dev at lists.sip-router.org>
>     http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-dev
>
>
>
>
> _______________________________________________
> sr-dev mailing list
> sr-dev at lists.sip-router.org
> http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-dev

-- 
Daniel-Constantin Mierla - http://www.asipto.com
http://twitter.com/#!/miconda - http://www.linkedin.com/in/miconda
Kamailio Advanced Training, Seattle, USA, Sep 23-26, 2012 - http://asipto.com/u/katu
Kamailio Practical Workshop, Netherlands, Sep 10-12, 2012 - http://asipto.com/u/kpw



-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.sip-router.org/pipermail/sr-dev/attachments/20120611/1075f007/attachment-0001.htm>


More information about the sr-dev mailing list