summaryrefslogtreecommitdiffstats
path: root/src/responder/common
diff options
context:
space:
mode:
authorStephen Gallagher <sgallagh@redhat.com>2010-06-14 10:05:04 -0400
committerStephen Gallagher <sgallagh@redhat.com>2010-06-14 16:54:29 -0400
commit133bbb3c5e489f2f6eff711b0f8110ea47cb146f (patch)
treed028fbb4dd52a2de9abcc30a105ddaf6cd3e34d1 /src/responder/common
parent95e6cf406d0796dfb4031137410baa0a165f0c2b (diff)
downloadsssd-133bbb3c5e489f2f6eff711b0f8110ea47cb146f.tar.gz
sssd-133bbb3c5e489f2f6eff711b0f8110ea47cb146f.tar.xz
sssd-133bbb3c5e489f2f6eff711b0f8110ea47cb146f.zip
Properly null-terminate socket path
https://fedorahosted.org/sssd/ticket/540
Diffstat (limited to 'src/responder/common')
-rw-r--r--src/responder/common/responder_common.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/responder/common/responder_common.c b/src/responder/common/responder_common.c
index 54d6c49e1..231d82806 100644
--- a/src/responder/common/responder_common.c
+++ b/src/responder/common/responder_common.c
@@ -467,7 +467,8 @@ static int set_unix_socket(struct resp_ctx *rctx)
memset(&addr, 0, sizeof(addr));
addr.sun_family = AF_UNIX;
- strncpy(addr.sun_path, rctx->sock_name, sizeof(addr.sun_path));
+ strncpy(addr.sun_path, rctx->sock_name, sizeof(addr.sun_path)-1);
+ addr.sun_path[sizeof(addr.sun_path)-1] = '\0';
/* make sure we have no old sockets around */
unlink(rctx->sock_name);
@@ -504,7 +505,8 @@ static int set_unix_socket(struct resp_ctx *rctx)
memset(&addr, 0, sizeof(addr));
addr.sun_family = AF_UNIX;
- strncpy(addr.sun_path, rctx->priv_sock_name, sizeof(addr.sun_path));
+ strncpy(addr.sun_path, rctx->priv_sock_name, sizeof(addr.sun_path)-1);
+ addr.sun_path[sizeof(addr.sun_path)-1] = '\0';
unlink(rctx->priv_sock_name);