[Devel] A small bug in msg_translator.c (maybe already fixed in cvs?)

Daniel-Constantin Mierla daniel at voice-system.ro
Tue Jan 17 19:14:08 CET 2006


Hello,

thanks, the fix is now on cvs.

Cheers,
Daniel


On 01/17/06 14:30, Quang Minh Phan wrote:
>
> Hi List,
>
> I ran SER with Valgrind and found that sometimes SER accessed to 
> uninitialized variable. I tracked it down and saw a small problem in 
> this segment of code in the file msg_translator.c (line 1794 - 
> SER-0.9.6).
>
> /totags=((struct to_body*)(hdr->parsed))->tag_value.s;/
>
> / if (totags) {/
>
> / bmark->to_tag_val.s=p+(totags-hdr->name.s);/
>
> / bmark->to_tag_val.len=/
>
> / ((struct to_body*)(hdr->parsed))->tag_value.len;/
>
> / };/
>
> /case HDR_FROM:/
>
> The value of bmark is then used in some functions but it is not 
> initialized when totags is NULL.
>
> Here is what I added to the code and the warning message disapeared 
> from Valgrind log :
>
> /totags=((struct to_body*)(hdr->parsed))->tag_value.s;/
>
> / if (totags) {/
>
> / bmark->to_tag_val.s=p+(totags-hdr->name.s);/
>
> / bmark->to_tag_val.len=/
>
> / ((struct to_body*)(hdr->parsed))->tag_value.len;/
>
> / }/
>
> / else {/
>
> / bmark->to_tag_val.s = NULL ;/
>
> / bmark->to_tag_val.len = 0 ;/
>
> /}/
>
> case HDR_FROM:
>
> Sorry if this problem has already been mentioned before in the list 
> because I haven’t following the posts in the recently,
>
> Regards,
>
> Minh Phan
>
> ------------------------------------------------------------------------
>
> _______________________________________________
> Devel mailing list
> Devel at openser.org
> http://openser.org/cgi-bin/mailman/listinfo/devel
>   



More information about the Devel mailing list