diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/libstrongswan/utils/host.c | 6 |
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: |