Change in osmo-sgsn[master]: gtphub: fix compilation with gcc 10.2.0

This is merely a historical archive of years 2008-2021, before the migration to mailman3.

A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/gerrit-log@lists.osmocom.org/.

lynxis lazus gerrit-no-reply at lists.osmocom.org
Fri Oct 2 00:40:51 UTC 2020


lynxis lazus has uploaded this change for review. ( https://gerrit.osmocom.org/c/osmo-sgsn/+/20395 )


Change subject: gtphub: fix compilation with gcc 10.2.0
......................................................................

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: I64f1b80657583dde738bc33e8cece6589322f1bf

Change-Id: Ied9665ce6bd2633797bbc3a2171e911ada357a22
---
M src/gtphub/gtphub.c
1 file changed, 1 insertion(+), 1 deletion(-)



  git pull ssh://gerrit.osmocom.org:29418/osmo-sgsn refs/changes/95/20395/1

diff --git a/src/gtphub/gtphub.c b/src/gtphub/gtphub.c
index c95696a..699499f 100644
--- a/src/gtphub/gtphub.c
+++ b/src/gtphub/gtphub.c
@@ -2899,9 +2899,9 @@
 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,

-- 
To view, visit https://gerrit.osmocom.org/c/osmo-sgsn/+/20395
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-sgsn
Gerrit-Branch: master
Gerrit-Change-Id: Ied9665ce6bd2633797bbc3a2171e911ada357a22
Gerrit-Change-Number: 20395
Gerrit-PatchSet: 1
Gerrit-Owner: lynxis lazus <lynxis at fe80.eu>
Gerrit-MessageType: newchange
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20201002/cb1a7267/attachment.htm>


More information about the gerrit-log mailing list