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/.

laforge gerrit-no-reply at lists.osmocom.org
Sun Oct 4 11:34:03 UTC 2020


laforge has submitted this change. ( 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: Ied9665ce6bd2633797bbc3a2171e911ada357a22
---
M src/gtphub/gtphub.c
1 file changed, 1 insertion(+), 1 deletion(-)

Approvals:
  Jenkins Builder: Verified
  laforge: Looks good to me, approved



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: 2
Gerrit-Owner: lynxis lazus <lynxis at fe80.eu>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: laforge <laforge at osmocom.org>
Gerrit-Reviewer: pespin <pespin at sysmocom.de>
Gerrit-MessageType: merged
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20201004/9062f74a/attachment.htm>


More information about the gerrit-log mailing list