client: fix truncation of long hostnames
This commit is contained in:
parent
946ee8f611
commit
46061d8eec
1 changed files with 2 additions and 3 deletions
5
client.c
5
client.c
|
@ -1952,9 +1952,8 @@ format_name(char *buf, int size, int trunc_dns, int ref, uint32_t ref_id,
|
||||||
snprintf(buf, size, "%s", UTI_IPToString(ip_addr));
|
snprintf(buf, size, "%s", UTI_IPToString(ip_addr));
|
||||||
} else {
|
} else {
|
||||||
DNS_IPAddress2Name(ip_addr, buf, size);
|
DNS_IPAddress2Name(ip_addr, buf, size);
|
||||||
if (size > trunc_dns) {
|
if (trunc_dns > 0 && strlen(buf) > trunc_dns) {
|
||||||
if (trunc_dns > 0)
|
buf[trunc_dns - 1] = '>';
|
||||||
buf[trunc_dns - 1] = '>';
|
|
||||||
buf[trunc_dns] = '\0';
|
buf[trunc_dns] = '\0';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue