Change in libosmocore[master]: fix strncpy bug in gprs_ns2_fr_bind()

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
Fri Dec 18 11:12:16 UTC 2020


laforge has submitted this change. ( https://gerrit.osmocom.org/c/libosmocore/+/21780 )

Change subject: fix strncpy bug in gprs_ns2_fr_bind()
......................................................................

fix strncpy bug in gprs_ns2_fr_bind()

This use of strncpy() fails to account for the terminating nul
character. Use OSMO_STRLCPY_ARRAY() instead.

(Interestingly my compiler doesn't complain about this one, though it
failed on another similar use of strncpy().)

Change-Id: Id53e940c7a39ab154966548f4173a179c5bc9151
---
M src/gb/gprs_ns2_fr.c
1 file changed, 1 insertion(+), 1 deletion(-)

Approvals:
  fixeria: Looks good to me, approved
  pespin: Looks good to me, but someone else must approve
  Jenkins Builder: Verified



diff --git a/src/gb/gprs_ns2_fr.c b/src/gb/gprs_ns2_fr.c
index 1ff80ed..782e5a3 100644
--- a/src/gb/gprs_ns2_fr.c
+++ b/src/gb/gprs_ns2_fr.c
@@ -497,7 +497,7 @@
 		rc = -EINVAL;
 		goto err_priv;
 	}
-	strncpy(priv->netif, netif, sizeof(priv->netif));
+	OSMO_STRLCPY_ARRAY(priv->netif, netif);
 
 	if (result)
 		*result = bind;

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

Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-Change-Id: Id53e940c7a39ab154966548f4173a179c5bc9151
Gerrit-Change-Number: 21780
Gerrit-PatchSet: 2
Gerrit-Owner: neels <nhofmeyr at sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: fixeria <vyanitskiy at sysmocom.de>
Gerrit-Reviewer: laforge <laforge at osmocom.org>
Gerrit-Reviewer: lynxis lazus <lynxis at fe80.eu>
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/20201218/f85b1613/attachment.htm>


More information about the gerrit-log mailing list