[Freeswitch-dev] get_trillium_val() loop termination

Moises Silva moises.silva at gmail.com
Wed Feb 1 20:20:42 MSK 2012


> On Feb 1, 2012, at 8:42 AM, Juraj Fabo wrote:
>
> Hi
>
> I'm using freetdm from git downloaded on 30.1.2012.
> On windows I had no problems, but on sles 11 sp1 64bit call setup message
> was missing caller and called information elements.
> I've tracked down the problem to file
> src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_support.c, into function
> get_trillium_val()
> Particularly, when get_trillium_val(ton_codes, 0, IN_TON_UNK) is called,
> 0xe6 is returned (which is from the nsf_spec_codes[] table)
> I think the loop should have some strict terminate condition but not sure
> about the write intention.
> My workaround to be able to continue development is following
>
> diff -urN src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_support.c
> src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_support_mod.c
> --- src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_support.c   2012-02-01
> 14:02:30.000000000 +0000
> +++ src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_support_mod.c
> 2012-02-01 14:02:08.000000000 +0000
> @@ -106,10 +106,11 @@
> static uint8_t get_trillium_val(ftdm2trillium_t *vals, uint8_t ftdm_val,
> uint8_t default_val)
> {
>        ftdm2trillium_t *val = vals;
> -       while(val++) {
> +       while(val) {
>                if (val->ftdm_val == ftdm_val) {
>                        return val->trillium_val;
>                }
> +                val++;
>        }
>        return default_val;
> }
> @@ -117,10 +118,11 @@
> static uint8_t get_ftdm_val(ftdm2trillium_t *vals, uint8_t trillium_val,
> uint8_t default_val)
> {
>        ftdm2trillium_t *val = vals;
> -       while(val++) {
> +       while(val) {
>                if (val->trillium_val == trillium_val) {
>                        return val->ftdm_val;
>                }
> +                val++;
>        }
>        return default_val;
> }
>
> Is there some other way how to go around?
>
>
All that looping code was f'd up pretty bad and it was fixed yesterday.
Update to see the fix.

*Moises Silva
**Software Engineer, Development Manager***

msilva at sangoma.com

Sangoma Technologies

100 Renfrew Drive, Suite 100, Markham, ON L3R 9R6 Canada


t.   +1 800 388 2475 (N. America)

t.   +1 905 474 1990 x128

f.   +1 905 474 9223



**<http://www.sangoma.com/contact?utm_source=signature&utm_medium=email&utm_campaign=email+signatures>

Products<http://sangoma.com/products?utm_source=signature&utm_medium=email&utm_campaign=email%2Bsignatures>
 | Solutions<http://sangoma.com/solutions?utm_source=signature&utm_medium=email&utm_campaign=email%2Bsignatures>
 | Events<http://sangoma.com/about_us/events?utm_source=signature&utm_medium=email&utm_campaign=email%2Bsignatures>
 | Contact<http://www.sangoma.com/contact?utm_source=signature&utm_medium=email&utm_campaign=email%2Bsignatures>
 | Wiki<http://wiki.sangoma.com/?utm_source=signature&utm_medium=email&utm_campaign=email%2Bsignatures>
 | Facebook<http://www.facebook.com/pages/Sangoma-VoIP-Cards/43578453335?utm_source=signature&utm_medium=email&utm_campaign=email%2Bsignatures>
 | Twitter<http://www.twitter.com/sangoma?utm_source=signature&utm_medium=email&utm_campaign=email%2Bsignatures>`|
| YouTube<http://www.youtube.com/sangomatechnologies?utm_source=signature&utm_medium=email&utm_campaign=email%2Bsignatures>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.freeswitch.org/pipermail/freeswitch-dev/attachments/20120201/446ea14e/attachment-0001.html 


Join us at ClueCon 2011 Aug 9-11, 2011
More information about the FreeSWITCH-dev mailing list