aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeter Maydell <peter.maydell@linaro.org>2017-03-28 18:37:32 +0100
committerPeter Maydell <peter.maydell@linaro.org>2017-03-28 18:37:32 +0100
commita634bbbafc177c2cc94843fac8a05ec4875b7b2b (patch)
tree217559bb28223b7f5263e338b80a5f2753770983
parentb8dc35b2526278296390fffa80b5c82573ed178a (diff)
parent44fdc764550e048a2810955da7cabbfaf636231a (diff)
Merge remote-tracking branch 'remotes/armbru/tags/pull-misc-2017-03-28' into staging
Miscellaneous patches for 2017-03-28 # gpg: Signature made Tue 28 Mar 2017 17:51:06 BST # gpg: using RSA key 0x3870B400EB918653 # gpg: Good signature from "Markus Armbruster <armbru@redhat.com>" # gpg: aka "Markus Armbruster <armbru@pond.sub.org>" # Primary key fingerprint: 354B C8B3 D7EB 2A6B 6867 4E5F 3870 B400 EB91 8653 * remotes/armbru/tags/pull-misc-2017-03-28: sockets: Fix socket_address_to_string() hostname truncation Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
-rw-r--r--util/qemu-sockets.c9
1 files changed, 2 insertions, 7 deletions
diff --git a/util/qemu-sockets.c b/util/qemu-sockets.c
index 7c120c45ce..40164bf681 100644
--- a/util/qemu-sockets.c
+++ b/util/qemu-sockets.c
@@ -1307,19 +1307,14 @@ char *socket_address_to_string(struct SocketAddress *addr, Error **errp)
{
char *buf;
InetSocketAddress *inet;
- char host_port[INET6_ADDRSTRLEN + 5 + 4];
switch (addr->type) {
case SOCKET_ADDRESS_KIND_INET:
inet = addr->u.inet.data;
if (strchr(inet->host, ':') == NULL) {
- snprintf(host_port, sizeof(host_port), "%s:%s", inet->host,
- inet->port);
- buf = g_strdup(host_port);
+ buf = g_strdup_printf("%s:%s", inet->host, inet->port);
} else {
- snprintf(host_port, sizeof(host_port), "[%s]:%s", inet->host,
- inet->port);
- buf = g_strdup(host_port);
+ buf = g_strdup_printf("[%s]:%s", inet->host, inet->port);
}
break;