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

Quang Minh Phan quang-minh.phan at wengo.fr
Tue Jan 17 13:30:05 CET 2006


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

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://openser.org/pipermail/devel/attachments/20060117/9fddecab/attachment.htm


More information about the Devel mailing list