From a333108465ff50726b5348649e40e902043b020a Mon Sep 17 00:00:00 2001 From: Christian Grothoff Date: Wed, 24 Apr 2013 13:11:09 +0000 Subject: [PATCH] -make sure result is 0-terminated for UDS --- src/util/common_logging.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/util/common_logging.c b/src/util/common_logging.c index cd845ccce..5b355b2e1 100644 --- a/src/util/common_logging.c +++ b/src/util/common_logging.c @@ -1206,7 +1206,8 @@ GNUNET_a2s (const struct sockaddr *addr, socklen_t addrlen) off = 0; if (un->sun_path[0] == '\0') off++; - snprintf (buf, sizeof (buf), "%s%.*s", (off == 1) ? "@" : "", + memset (buf, 0, sizeof (buf)); + snprintf (buf, sizeof (buf) - 1, "%s%.*s", (off == 1) ? "@" : "", (int) (addrlen - sizeof (sa_family_t) - 1 - off), &un->sun_path[off]); return buf; -- 2.25.1