Bug in libs/valuepair.c pairmake function

Mitchell, Michael J Michael.Mitchell at team.telstra.com
Wed Jun 28 09:52:23 CEST 2006


Hi Alan and developers,

I've found a small bug in libs/valuepair.c in the pairmake() function
when trying to call pairmake on an attribute with a tag (eg tunnel
attributes from dictionary.tunnel). For example
pairmake("Tunnel-Preference:1", "1", T_OP_EQ)

The code searches for a ":" in the attribute name which has been passed
in, and if it finds a valid tag, sets the position of the ":" to 0 (a
null). However, the attribute name is declared as a "const char *".

I resolved the issue by doing a strdup on the attribute name to a local
char * variable and then using that variable in the rest of the
function. Making attribute non const doesn't seem like a good idea.

cheers,
Mike




More information about the Freeradius-Devel mailing list