diff options
author | Christian Grothoff <christian@grothoff.org> | 2013-04-24 13:11:09 +0000 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2013-04-24 13:11:09 +0000 |
commit | a333108465ff50726b5348649e40e902043b020a (patch) | |
tree | ae9711ed483ccc5cb946c3d541feba5283cccbeb /src/util/common_logging.c | |
parent | f7858cf7ca335571e950c76a554def81c5538b75 (diff) | |
download | gnunet-a333108465ff50726b5348649e40e902043b020a.tar.gz gnunet-a333108465ff50726b5348649e40e902043b020a.zip |
-make sure result is 0-terminated for UDS
Diffstat (limited to 'src/util/common_logging.c')
-rw-r--r-- | src/util/common_logging.c | 3 |
1 files changed, 2 insertions, 1 deletions
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) | |||
1206 | off = 0; | 1206 | off = 0; |
1207 | if (un->sun_path[0] == '\0') | 1207 | if (un->sun_path[0] == '\0') |
1208 | off++; | 1208 | off++; |
1209 | snprintf (buf, sizeof (buf), "%s%.*s", (off == 1) ? "@" : "", | 1209 | memset (buf, 0, sizeof (buf)); |
1210 | snprintf (buf, sizeof (buf) - 1, "%s%.*s", (off == 1) ? "@" : "", | ||
1210 | (int) (addrlen - sizeof (sa_family_t) - 1 - off), | 1211 | (int) (addrlen - sizeof (sa_family_t) - 1 - off), |
1211 | &un->sun_path[off]); | 1212 | &un->sun_path[off]); |
1212 | return buf; | 1213 | return buf; |