Quoting Oded Arbel <[EMAIL PROTECTED]>:

> (...)
> 
> The problem lies in the piece of code that attempts to read the
> keepalive configuration parameter - it uses a an uninitialized temp
> variable as a parameter to cfg_get_integer(), and assumes that if
> keepalive isn't set in the configuration, that variable will be inited
> to -1. but cfg_get_integer() does not init the parameter it is given at
> all - it just passes it to octsr_parse_long() - something which doesn't
> happen at all if the value it is looking for in the configuration isn't
> found. so the temp variable gets used w/o initialization (don't know why
> gcc didn't catch it) and so privdata->keepalive will contain an arbitary
> value if not set explicitly. 
> 
> I don't know if cfg_get_integer() should be fixed, but the following
> patch to smsc_at2.c will also solve the problem.

We can't patch cfg_get_integer (I've tried it) because the behaviour is:

- x=2;
- cfg_get_integer(&x...."var")

if var does not exists or is not parsable, nor cfg_get_integer nor 
octstr_parse_long would touch the x, therefor x will always be equal to 2.

That way, I can say "speed=9600" (default) and cfg_get_integer(&speed, ..)
If speed is set, my var will have its value, else will have the default I've
set

(It happens in smsbox, with default sms length and smsbox port).


Patch is almost done...



> 
> --
> Oded Arbel
> m-Wise Inc.
> [EMAIL PROTECTED]
> 
> A man is rich in proportion to the number of things which he can afford
> to let alone.
> 
> 
> 
> 


-- 
Davi

Reply via email to