[sr-dev] sca module warnings

Daniel-Constantin Mierla miconda at gmail.com
Thu Nov 7 20:26:04 CET 2013


Hello,

compiling sca module rises next warning:

sca_call_info.c: In function ‘sca_call_info_update’:
sca_call_info.c:1977:7: warning: the comparison will always evaluate as 
‘true’ for the address of ‘call_info’ will never be NULL [-Waddress]
sca_call_info.c:1984:14: warning: the comparison will always evaluate as 
‘true’ for the address of ‘call_info’ will never be NULL [-Waddress]

The lead to the next define, which does not seem right at first sight

#define SCA_CALL_INFO_EMPTY( ci1 ) \
((ci1) != NULL || \
((ci1)->index == SCA_CALL_INFO_APPEARANCE_INDEX_ANY && \
(ci1)->state == SCA_APPEARANCE_STATE_UNKNOWN))

Either first condition has to be ==NULL or the || has to be relaplced by 
&&. Otherwise, if stays like now, if ci1==NULL, will result in a crash, 
by accessing ->index and ->state of a null pointer.

Cheers,
Daniel

-- 
Daniel-Constantin Mierla - http://www.asipto.com
http://twitter.com/#!/miconda - http://www.linkedin.com/in/miconda
Kamailio Advanced Trainings - Berlin, Nov 25-28
   - more details about Kamailio trainings at http://www.asipto.com -




More information about the sr-dev mailing list