Commit 6589b7d7 authored by Pekka Pessi's avatar Pekka Pessi

sres_sip.c: check log level in sres_sip_append_result()

Be lazy expanding binary addresses.

MeeGo Coverity issue CID#11745
parent dce4bc7b
......@@ -1625,7 +1625,7 @@ sres_sip_append_result(sres_sip_t *srs,
break;
}
if ((srs->srs_canonname && srs->srs_numeric) || (SU_LOG->log_level >= 0)) {
if ((srs->srs_canonname && srs->srs_numeric) || (SU_LOG->log_level >= 5)) {
unsigned port = 0;
char const *lb = "", *rb = "";
......@@ -1660,6 +1660,7 @@ sres_sip_append_result(sres_sip_t *srs,
if (!srs->srs_canonname)
canonname = NULL;
if (canonname) {
clen = strlen(canonname);
if (clen && canonname[clen - 1] == '.')
......@@ -1676,6 +1677,7 @@ sres_sip_append_result(sres_sip_t *srs,
*ai = *result;
ai->ai_next = NULL;
ai->ai_addr = memcpy(ai + 1, ai->ai_addr, ai->ai_addrlen);
if (canonname) {
ai->ai_canonname = (char *)(ai->ai_addr) + ai->ai_addrlen;
memcpy(ai->ai_canonname, canonname, clen - 1);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment