@linuxmaniac, @miconda, I work with @davidxbwang

I found the issue in modules/pv/pv_core.c. Function pv_get_srcip(). We should substitute the function ip_addr2strz() for ip_addr2a(). ip_addr2strz() correctly inserts the [] in the string when the address is IPv6. Also, I noticed that both of these functions use a static buffer that is one character too small. Since they put a null terminator, if you have a maximum size IPv6 address (no leading zeros) you will overwrite the end of the buffer.

We tested the fix, and, it appears to not affect other parts of the code that might not expect the brackets [] added.

Below the fix is shown with the old line commented out.

int pv_get_srcip(struct sip_msg *msg, pv_param_t *param,
pv_value_t *res)
{
str s;
if(msg==NULL)
return -1;

    //s.s = ip_addr2a(&msg->rcv.src_ip);
    s.s = ip_addr2strz(&msg->rcv.src_ip);
    s.len = strlen(s.s);
    return pv_get_strval(msg, param, res, &s);

}

Don.


You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub, or mute the thread.