aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTed Gould <ted@gould.cx>2012-08-28 15:14:40 -0500
committerTed Gould <ted@gould.cx>2012-08-28 15:14:40 -0500
commit55183a443d93485c8cf9a060b5025cdd10a73d9b (patch)
tree4fff3e76edacdedbee4e55a63e749734afa18634
parent66187012c38bfe7c0fd3022b6f0135db575142ca (diff)
downloadlibpam-freerdp2-55183a443d93485c8cf9a060b5025cdd10a73d9b.tar.gz
libpam-freerdp2-55183a443d93485c8cf9a060b5025cdd10a73d9b.tar.bz2
libpam-freerdp2-55183a443d93485c8cf9a060b5025cdd10a73d9b.zip
Making sure that there's no way that we can write over the end of the buffer even for very, very, very long home directory names.
-rw-r--r--src/pam-freerdp.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/pam-freerdp.c b/src/pam-freerdp.c
index f635162..8129787 100644
--- a/src/pam-freerdp.c
+++ b/src/pam-freerdp.c
@@ -283,7 +283,7 @@ pam_sm_open_session (pam_handle_t *pamh, int flags, int argc, const char ** argv
memset(&socket_addr, 0, sizeof(struct sockaddr_un));
socket_addr.sun_family = AF_UNIX;
strncpy(socket_addr.sun_path, pwdent->pw_dir, sizeof(socket_addr.sun_path) - 1);
- strncpy(socket_addr.sun_path + strlen(pwdent->pw_dir), "/.freerdp-socket", sizeof(socket_addr.sun_path) - 1);
+ strncpy(socket_addr.sun_path + strlen(pwdent->pw_dir), "/.freerdp-socket", (sizeof(socket_addr.sun_path) - strlen(pwdent->pw_dir)) - 1);
/* We bind the socket before forking so that we ensure that
there isn't a race condition to get to it. Things will block