Change in libosmocore[master]: fix strncpy bugs in socket.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:15:45 UTC 2018


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

Change subject: fix strncpy bugs in socket.c
......................................................................

fix strncpy bugs in socket.c

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

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



diff --git a/src/socket.c b/src/socket.c
index 0405847..dc5590c 100644
--- a/src/socket.c
+++ b/src/socket.c
@@ -596,8 +596,7 @@
 		return -EINVAL;
 
 	local.sun_family = AF_UNIX;
-	strncpy(local.sun_path, socket_path, sizeof(local.sun_path));
-	local.sun_path[sizeof(local.sun_path) - 1] = '\0';
+	osmo_strlcpy(local.sun_path, socket_path, sizeof(local.sun_path));
 
 #if defined(BSD44SOCKETS) || defined(__UNIXWARE__)
 	local.sun_len = strlen(local.sun_path);

-- 
To view, visit https://gerrit.osmocom.org/10175
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: Iddf36d26b23dcef4f9b291fd7ead1907e38c3486
Gerrit-Change-Number: 10175
Gerrit-PatchSet: 4
Gerrit-Owner: Neels Hofmeyr <nhofmeyr at sysmocom.de>
Gerrit-Reviewer: Harald Welte <laforge at gnumonks.org>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: Pau Espin Pedrol <pespin at sysmocom.de>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20180727/a24a6c11/attachment.htm>


More information about the gerrit-log mailing list