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

neels gerrit-no-reply at lists.osmocom.org
Thu Dec 17 17:21:03 UTC 2020


neels has uploaded this change for review. ( 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(-)



  git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/80/21780/1

diff --git a/src/gb/gprs_ns2_fr.c b/src/gb/gprs_ns2_fr.c
index 6f9cd8d..f6a17ea 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: 1
Gerrit-Owner: neels <nhofmeyr at sysmocom.de>
Gerrit-MessageType: newchange
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20201217/a4d5ec80/attachment.htm>


More information about the gerrit-log mailing list