diff --git a/pkcs11/rpc-layer/gkm-rpc-dispatch.c b/pkcs11/rpc-layer/gkm-rpc-dispatch.c index 72d2ced1f3d455fce03459e633a46958e9568162..dbedb355e656498ff04f61e0e7b7a62dcfe375bb 100644 --- a/pkcs11/rpc-layer/gkm-rpc-dispatch.c +++ b/pkcs11/rpc-layer/gkm-rpc-dispatch.c @@ -31,6 +31,8 @@ #include "egg/egg-error.h" #include "egg/egg-unix-credentials.h" +#include + #include #include #include @@ -2379,7 +2381,7 @@ gkm_rpc_layer_startup (const char *prefix) memset(&addr, 0, sizeof(addr)); addr.sun_family = AF_UNIX; unlink (pkcs11_socket_path); - strncpy (addr.sun_path, pkcs11_socket_path, sizeof (addr.sun_path)); + g_strlcpy (addr.sun_path, pkcs11_socket_path, sizeof (addr.sun_path)); if (bind (sock, (struct sockaddr*)&addr, sizeof (addr)) < 0) { gkm_rpc_warn ("couldn't bind to pkcs11 socket: %s: %s", pkcs11_socket_path, strerror (errno)); diff --git a/pkcs11/rpc-layer/gkm-rpc-module.c b/pkcs11/rpc-layer/gkm-rpc-module.c index 24457ce18c09479e95f4f5677c725c611c092837..515b18a4d96bef0a98daa777892a82ff002d9871 100644 --- a/pkcs11/rpc-layer/gkm-rpc-module.c +++ b/pkcs11/rpc-layer/gkm-rpc-module.c @@ -29,6 +29,8 @@ #include "egg/egg-unix-credentials.h" +#include + #include #include #include @@ -233,7 +235,7 @@ call_connect (CallState *cs) debug (("connecting to: %s", pkcs11_socket_path)); addr.sun_family = AF_UNIX; - strncpy (addr.sun_path, pkcs11_socket_path, sizeof (addr.sun_path)); + g_strlcpy (addr.sun_path, pkcs11_socket_path, sizeof (addr.sun_path)); sock = socket (AF_UNIX, SOCK_STREAM, 0); if (sock < 0) {