diff --git a/common/os_calls.c b/common/os_calls.c index 09aa61e8..ef057497 100644 --- a/common/os_calls.c +++ b/common/os_calls.c @@ -778,6 +778,8 @@ g_tcp_local_connect(int sck, const char *port) memset(&s, 0, sizeof(struct sockaddr_un)); s.sun_family = AF_UNIX; strncpy(s.sun_path, port, sizeof(s.sun_path)); + s.sun_path[sizeof(s.sun_path) - 1] = 0; + return connect(sck, (struct sockaddr *)&s, sizeof(struct sockaddr_un)); #endif } @@ -938,6 +940,8 @@ g_tcp_local_bind(int sck, const char *port) memset(&s, 0, sizeof(struct sockaddr_un)); s.sun_family = AF_UNIX; strncpy(s.sun_path, port, sizeof(s.sun_path)); + s.sun_path[sizeof(s.sun_path) - 1] = 0; + return bind(sck, (struct sockaddr *)&s, sizeof(struct sockaddr_un)); #endif } diff --git a/sesman/chansrv/chansrv_fuse.c b/sesman/chansrv/chansrv_fuse.c index 993b6594..1d78bbfb 100644 --- a/sesman/chansrv/chansrv_fuse.c +++ b/sesman/chansrv/chansrv_fuse.c @@ -1801,7 +1801,8 @@ void xfuse_devredir_cb_rename_file(void *vp, tui32 IoStatus) } old_xinode->parent_inode = fip->new_inode; - strcpy(old_xinode->name, fip->new_name); + strncpy(old_xinode->name, fip->new_name, 1023); + old_xinode->name[1023] = 0; if (fip->inode != fip->new_inode) { diff --git a/sesman/chansrv/chansrv_fuse.h b/sesman/chansrv/chansrv_fuse.h index 41a73062..4638add5 100644 --- a/sesman/chansrv/chansrv_fuse.h +++ b/sesman/chansrv/chansrv_fuse.h @@ -34,7 +34,7 @@ struct xrdp_inode time_t atime; /* Time of last access. */ time_t mtime; /* Time of last modification. */ time_t ctime; /* Time of last status change. */ - char name[256]; /* Dir or filename */ + char name[1024]; /* Dir or filename */ tui32 device_id; /* for file system redirection */ char is_synced; /* dir struct has been read from */ /* remote device, done just once */