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 <[email protected]>

Reply via email to