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

Jason Penton jason.penton at gmail.com
Mon Jun 11 14:36:25 CEST 2012


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
> 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>
> Committer: Daniel-Constantin Mierla <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
> http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-dev
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.sip-router.org/pipermail/sr-dev/attachments/20120611/1215a742/attachment.htm>


More information about the sr-dev mailing list