aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlexander Couzens <lynxis@fe80.eu>2020-10-02 00:15:43 +0200
committerAlexander Couzens <lynxis@fe80.eu>2020-10-03 20:37:15 +0200
commit92ef0c8675dec1f90a7525773fc84fd13afe7b57 (patch)
treedfb9ffcbe427508685f08f96b5b5b4ee6455aeaf
parent68d9c5a468ea6eca354cb7ece914e48c028257e3 (diff)
gtphub: fix compilation with gcc 10.2.0
gtphub.c:2915:2: error: ‘snprintf’ argument 4 may overlap destination object ‘buf’ [-Werror=restrict] 2915 | snprintf(pos, len, " port %s", portbuf); | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Be better safe and use the stack instead of byte counting in the buffer. Change-Id: Ied9665ce6bd2633797bbc3a2171e911ada357a22
-rw-r--r--src/gtphub/gtphub.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/gtphub/gtphub.c b/src/gtphub/gtphub.c
index c95696af..699499f3 100644
--- a/src/gtphub/gtphub.c
+++ b/src/gtphub/gtphub.c
@@ -2899,9 +2899,9 @@ int sgsn_sockaddr_to_strs(char *addr_str, size_t addr_str_len,
const char *sgsn_sockaddr_to_strb(const struct sgsn_sockaddr *addr,
char *buf, size_t buf_len)
{
+ char portbuf[6];
const int portbuf_len = 6;
OSMO_ASSERT(buf_len > portbuf_len);
- char *portbuf = buf + buf_len - portbuf_len;
buf_len -= portbuf_len;
if (sgsn_sockaddr_to_strs(buf, buf_len,
portbuf, portbuf_len,