From c0d1ebde71116cbe494b445da9c08cf5454ff201 Mon Sep 17 00:00:00 2001 From: Martin Willi Date: Wed, 14 May 2008 06:34:54 +0000 Subject: [PATCH] fixed printing of %#H hosts --- src/libstrongswan/utils/host.c | 6 ++++-- 1 file 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: