[OpenSIPS-Devel] uri->host.s problem when using parse_from_uri

Andrew Mortensen admorten at isc.upenn.edu
Thu Apr 14 01:39:59 CEST 2011


On Apr 13, 2011, at 6:57 PM, Alejandro Rios P. wrote:

> Hi All,
> 
> I've been playing a little bit with the source code of 'closeddial' module (v1.6.2), and I'm having an issue with the 'parse_from_uri' function:
> 
> ...
> 
> 3. Then, I'm trying to use the 'host' part:
> ...
>                 LM_DBG("Comparing domain %s\n", from_uri->host.s);
>         }
> 
> 
> 4. But when running using debug, I'm getting not only the host part, but everything else in the rest of the message:

The "s" field isn't null terminated. You need to use the special %.*s placeholder for str variables:

LM_DBG("Comparing domain %.*s\n", from_uri->host.len, from_uri->host.s);

andrew


More information about the Devel mailing list