[Serusers] function get_from_did(&did, msg) error

Tomasz Zieleniewski tzieleniewski at gmail.com
Sun Dec 2 18:38:16 CET 2007


Hi,

I was trying to set up media proxy module and after some time of debuging I
discovered that the problems
were in the get_from_did(&did, msg) function. in mediaproxy.c file in line
469 there is such piece of code:
    if (get_from_did(&did, msg) == 0) {
   *type = "local";
   return did;
    }

when this code is invoked the result is wrong. this is some nowhere pointer
with the length of the field unpredictable.
after this invocation there is another piece of code wich tries to allocate
some memory baseing on the length of the did string.(line 1449)
    cmdlen = callId.len + strlen(clientIP) + fromDomain.len + toDomain.len +
        userAgent.len*3 + infolen + 128;
   command = pkg_malloc(cmdlen);
    if (!command) {
        LOG(L_ERR, "error: use_media_proxy() - (!command): out of
memory\n");
        return -1;
    }

this causes out of memory error when value of fromDomain.len gives random
big number(below example of one my shots)
Dec  2 18:17:17 rd ser[5884]:  route[MEDIA]: use_media_proxy()
Dec  2 18:17:17 rd ser[5884]: error: get_from_did - true
Dec  2 18:17:17 rd ser[5884]: error: callId.len: 44
Dec  2 18:17:17 rd ser[5884]: error: strlen(clientIP): 14
Dec  2 18:17:17 rd ser[5884]: error: fromDomain.len: 1235653920
Dec  2 18:17:17 rd ser[5884]: error: toDomain.len: 14
Dec  2 18:17:17 rd ser[5884]: error: userAgent.len*3: 96
Dec  2 18:17:17 rd ser[5884]: error: infolen: 107
Dec  2 18:17:17 rd ser[5884]: error: cmdlen 1235654349
Dec  2 18:17:17 rd ser[5884]: error: use_media_proxy() - (!command): out of
memory

please, can someone check this and fix

best regards
tomasz
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.sip-router.org/pipermail/sr-users/attachments/20071202/51e08d88/attachment.htm>


More information about the sr-users mailing list