The following code is accepted by the cfg parser and will run: ``` $xavp(test1=>stuff) = "america"; # Good $xavp(test2->stuff) = "bahamas"; # Bad - Hyphen instead of equals $xavp(test3) = "cuba"; # Bad - No name given xlog("L_WARN", "1: $xavp(test1)\n"); xlog("L_WARN", "2: $xavp(test2)\n"); xlog("L_WARN", "3: $xavp(test3)\n"); xlog("L_WARN", "4: $xavp(test1=>stuff)\n"); xlog("L_WARN", "5: $xavp(test2=>stuff)\n"); xlog("L_WARN", "6: $xavp(test3=>stuff)\n"); ``` This prints: ``` 1: <xavp:0x7ff16f82c898> 2: <null> 3: cuba 4: america 5: null <null> or general protection fault/ core was generated...... ``` The crash can be fixed by checking the child node type (incoming), but could there be more validation of the (x)avp variables. I notice that $avp's can be treated as $xavps i.e. the following is accepted. `$avp(test4=>stuff) = "dominica";`
Is the usage above intended to be acceptable?
--- Reply to this email directly or view it on GitHub: https://github.com/kamailio/kamailio/issues/511
In the case of ``` $avp(test4=>stuff) = "dominica"; ``` the name is just considered as a static string, not a structure field reference like for xavps.
It doesn't bother me that this is allowed, as all variables can have whatever they like as inner name and it is up to each to interpret it as they need.
Thanks for the fixes to the bugs you reported.
--- Reply to this email directly or view it on GitHub: https://github.com/kamailio/kamailio/issues/511#issuecomment-185092459
Related commits seems to be pushed now, if it is anything else to sort out, re-opn.
--- Reply to this email directly or view it on GitHub: https://github.com/kamailio/kamailio/issues/511#issuecomment-194543033
Closed #511.
--- Reply to this email directly or view it on GitHub: https://github.com/kamailio/kamailio/issues/511#event-584036007