[OpenSER-Devel] parse_avp_spec parameters

Dan Pascu dan at ag-projects.com
Thu Nov 8 12:09:54 UTC 2007


I've noticed that the parse_avp_spec function modifies it's input. The 
first argument is the avp name that should be parsed and the output 
values for type and avp_name (2nd and 3rd arguments) should be set. While 
parsing, if the name argument points to an avp with a string name, the 
name argument is modified and later assigned to avp_name.

I think this should be fixed, otherwise every caller must make a copy of 
the input name to be sure it is not modified, which is not optimal. 
Consider the case where the input name is a malloc'ed string and by 
modifying it, the reference to that memory location is lost causing 
trouble when an attempt to free it is made.

Internally the function should make its own copy if a modified version of 
the input name is needed.

-- 
Dan



More information about the Devel mailing list