From: Christian Grothoff Date: Wed, 24 Apr 2013 13:11:09 +0000 (+0000) Subject: -make sure result is 0-terminated for UDS X-Git-Tag: initial-import-from-subversion-38251~9166 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=a333108465ff50726b5348649e40e902043b020a;p=oweals%2Fgnunet.git -make sure result is 0-terminated for UDS --- 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;