Change in libosmo-netif[master]: fix strncpy bug in rs232.c

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

Harald Welte gerrit-no-reply at lists.osmocom.org
Fri Jul 27 18:16:13 UTC 2018


Harald Welte has submitted this change and it was merged. ( https://gerrit.osmocom.org/10178 )

Change subject: fix strncpy bug in rs232.c
......................................................................

fix strncpy bug in rs232.c

Change-Id: I2f3b7888acb4f25da22ffef4391e1d0831485483
---
M src/rs232.c
1 file changed, 1 insertion(+), 2 deletions(-)

Approvals:
  Jenkins Builder: Verified
  Harald Welte: Looks good to me, approved



diff --git a/src/rs232.c b/src/rs232.c
index da5b56b..28f1ba0 100644
--- a/src/rs232.c
+++ b/src/rs232.c
@@ -141,8 +141,7 @@
 
 void osmo_rs232_set_serial_port(struct osmo_rs232 *r, char *serial_port)
 {
-	strncpy(r->cfg.serial_port, serial_port, PATH_MAX);
-	r->cfg.serial_port[PATH_MAX-1] = '\0';
+	osmo_strlcpy(r->cfg.serial_port, serial_port, PATH_MAX);
 }
 
 void osmo_rs232_set_baudrate(struct osmo_rs232 *r, int baudrate)

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

Gerrit-Project: libosmo-netif
Gerrit-Branch: master
Gerrit-MessageType: merged
Gerrit-Change-Id: I2f3b7888acb4f25da22ffef4391e1d0831485483
Gerrit-Change-Number: 10178
Gerrit-PatchSet: 2
Gerrit-Owner: Neels Hofmeyr <nhofmeyr at sysmocom.de>
Gerrit-Reviewer: Harald Welte <laforge at gnumonks.org>
Gerrit-Reviewer: Jenkins Builder
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20180727/b190bc1f/attachment.htm>


More information about the gerrit-log mailing list