aboutsummaryrefslogtreecommitdiffstats
path: root/src/libstrongswan/utils/host.c
diff options
context:
space:
mode:
authorMartin Willi <martin@strongswan.org>2008-05-14 06:34:54 +0000
committerMartin Willi <martin@strongswan.org>2008-05-14 06:34:54 +0000
commitc0d1ebde71116cbe494b445da9c08cf5454ff201 (patch)
tree0769e0cfe1aba54cd0a09ae5371084858a5a6970 /src/libstrongswan/utils/host.c
parent8fb81c3f5b23d4270ae474449ed608fd5a5c3422 (diff)
downloadstrongswan-c0d1ebde71116cbe494b445da9c08cf5454ff201.tar.bz2
strongswan-c0d1ebde71116cbe494b445da9c08cf5454ff201.tar.xz
fixed printing of %#H hosts
Diffstat (limited to 'src/libstrongswan/utils/host.c')
-rw-r--r--src/libstrongswan/utils/host.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/libstrongswan/utils/host.c b/src/libstrongswan/utils/host.c
index bde7dc142..a2fa57927 100644
--- a/src/libstrongswan/utils/host.c
+++ b/src/libstrongswan/utils/host.c
@@ -120,6 +120,7 @@ static int print(FILE *stream, const struct printf_info *info,
{
void *address;
u_int16_t port;
+ int len;
address = &this->address6.sin6_addr;
port = this->address6.sin6_port;
@@ -140,8 +141,9 @@ static int print(FILE *stream, const struct printf_info *info,
}
else if (info->alt)
{
- snprintf(buffer, sizeof(buffer),
- "%s[%d]", buffer, ntohs(port));
+ len = strlen(buffer);
+ snprintf(buffer + len, sizeof(buffer) - len,
+ "[%d]", ntohs(port));
}
break;
default: