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
commitd9da9b90a2be88825b3219f21b5865872591bbdb (patch)
tree4fff3e76edacdedbee4e55a63e749734afa18634
parent6e7601e14089a79aec2accfa800c259049449b8e (diff)
downloadlibpam-x2go-d9da9b90a2be88825b3219f21b5865872591bbdb.tar.gz
libpam-x2go-d9da9b90a2be88825b3219f21b5865872591bbdb.tar.bz2
libpam-x2go-d9da9b90a2be88825b3219f21b5865872591bbdb.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