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

Greger V. Teigre greger at teigre.com
Mon Dec 3 10:12:15 CET 2007


Could you please post it on the tracker(.iptel.org)?
Please also include details on the OS and architecture.
g-)

Tomasz Zieleniewski wrote:
> 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
>
>
>
>
> ------------------------------------------------------------------------
>
> _______________________________________________
> Serdev mailing list
> Serdev at lists.iptel.org
> http://lists.iptel.org/mailman/listinfo/serdev
>   
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.sip-router.org/pipermail/sr-users/attachments/20071203/2589c16d/attachment.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/x-pkcs7-signature
Size: 2844 bytes
Desc: S/MIME Cryptographic Signature
URL: <http://lists.sip-router.org/pipermail/sr-users/attachments/20071203/2589c16d/attachment.bin>


More information about the sr-users mailing list