[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] [gnunet] branch master updated: Be explicit about truncatio
From: |
gnunet |
Subject: |
[GNUnet-SVN] [gnunet] branch master updated: Be explicit about truncation to silence warning. |
Date: |
Thu, 28 Feb 2019 15:46:33 +0100 |
This is an automated email from the git hooks/post-receive script.
dold pushed a commit to branch master
in repository gnunet.
The following commit(s) were added to refs/heads/master by this push:
new 66bc78945 Be explicit about truncation to silence warning.
66bc78945 is described below
commit 66bc78945b25884c422139638117980aa256335f
Author: Florian Dold <address@hidden>
AuthorDate: Thu Feb 28 15:40:36 2019 +0100
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/
---
src/util/network.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
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)
*end = '\0';
}
GNUNET_CRYPTO_hash_to_enc (&sh, &ae);
- strncat (unixpath, (char *) ae.encoding, 16);
+ ae.encoding[16] = '\0';
+ strcat (unixpath, (char *) ae.encoding);
return unixpath;
}
--
To stop receiving notification emails like this one, please contact
address@hidden
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [GNUnet-SVN] [gnunet] branch master updated: Be explicit about truncation to silence warning.,
gnunet <=