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

Neels Hofmeyr gerrit-no-reply at lists.osmocom.org
Thu Jul 26 15:24:00 UTC 2018


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



  git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/75/10175/1

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: newchange
Gerrit-Change-Id: Iddf36d26b23dcef4f9b291fd7ead1907e38c3486
Gerrit-Change-Number: 10175
Gerrit-PatchSet: 1
Gerrit-Owner: Neels Hofmeyr <nhofmeyr at sysmocom.de>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20180726/2d83bc88/attachment.htm>


More information about the gerrit-log mailing list