From 8fef761d14585e92528eda6cdb2a7b31154bcc70 Mon Sep 17 00:00:00 2001 From: Neels Hofmeyr Date: Thu, 17 Dec 2020 18:19:19 +0100 Subject: 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 --- src/gb/gprs_ns2_fr.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/gb/gprs_ns2_fr.c b/src/gb/gprs_ns2_fr.c index 1ff80ed0..782e5a36 100644 --- a/src/gb/gprs_ns2_fr.c +++ b/src/gb/gprs_ns2_fr.c @@ -497,7 +497,7 @@ int gprs_ns2_fr_bind(struct gprs_ns2_inst *nsi, rc = -EINVAL; goto err_priv; } - strncpy(priv->netif, netif, sizeof(priv->netif)); + OSMO_STRLCPY_ARRAY(priv->netif, netif); if (result) *result = bind; -- cgit v1.2.3