Change in libosmocore[master]: cosmetic: osmo-sim-test.c: use memcpy instead of strncpy

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:15:47 UTC 2018


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

Change subject: cosmetic: osmo-sim-test.c: use memcpy instead of strncpy
......................................................................

cosmetic: osmo-sim-test.c: use memcpy instead of strncpy

gcc 8.1.0 complains that the terminating \0 is not copied by strncpy, while
this code intends to do exactly that. Use memcpy instead.

Change-Id: I8d66fa22502c04d11ae153b9856d7e54f3492dd6
---
M utils/osmo-sim-test.c
1 file changed, 2 insertions(+), 1 deletion(-)

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



diff --git a/utils/osmo-sim-test.c b/utils/osmo-sim-test.c
index ea24120..5588294 100644
--- a/utils/osmo-sim-test.c
+++ b/utils/osmo-sim-test.c
@@ -74,7 +74,8 @@
 	msg = osim_new_apdumsg(0x00, 0x20, 0x00, pin_nr, 8, 0);
 	pindst = (char *) msgb_put(msg, 8);
 	memset(pindst, 0xFF, 8);
-	strncpy(pindst, pin, strlen(pin));
+	/* Do not copy the terminating \0 */
+	memcpy(pindst, pin, strlen(pin));
 
 	return osim_transceive_apdu(st, msg);
 }

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

Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-MessageType: merged
Gerrit-Change-Id: I8d66fa22502c04d11ae153b9856d7e54f3492dd6
Gerrit-Change-Number: 10176
Gerrit-PatchSet: 4
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/9eb5a9be/attachment.htm>


More information about the gerrit-log mailing list