aboutsummaryrefslogtreecommitdiff
path: root/src/util
diff options
context:
space:
mode:
authorFlorian Dold <florian.dold@gmail.com>2019-02-28 15:40:36 +0100
committerFlorian Dold <florian.dold@gmail.com>2019-02-28 15:46:13 +0100
commit66bc78945b25884c422139638117980aa256335f (patch)
tree62bbd96be7424c02ec33f0dc34c10431f1f0d867 /src/util
parent6603f7e1a837d3a51a1949a6f4e1802b6ef3d806 (diff)
downloadgnunet-66bc78945b25884c422139638117980aa256335f.tar.gz
gnunet-66bc78945b25884c422139638117980aa256335f.zip
Be explicit about truncation to silence warning.
Newer GCCs do not like truncation and emit a warning. We don't want to disable truncation warnings (-Wnostringop-truncation), as in some cases these warnings can point to a security flaw. Using strcat instead of strncat is fine, since *both* equally overflow the destination buffer if not used carefully. See https://developers.redhat.com/blog/2018/05/24/detecting-string-truncation-with-gcc-8/
Diffstat (limited to 'src/util')
-rw-r--r--src/util/network.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/util/network.c b/src/util/network.c
index a100be375..c236292b7 100644
--- a/src/util/network.c
+++ b/src/util/network.c
@@ -141,7 +141,8 @@ GNUNET_NETWORK_shorten_unixpath (char *unixpath)
141 *end = '\0'; 141 *end = '\0';
142 } 142 }
143 GNUNET_CRYPTO_hash_to_enc (&sh, &ae); 143 GNUNET_CRYPTO_hash_to_enc (&sh, &ae);
144 strncat (unixpath, (char *) ae.encoding, 16); 144 ae.encoding[16] = '\0';
145 strcat (unixpath, (char *) ae.encoding);
145 return unixpath; 146 return unixpath;
146} 147}
147 148