summaryrefslogtreecommitdiffstats
path: root/sesman
diff options
context:
space:
mode:
authorKentaro Hayashi <hayashi@clear-code.com>2016-07-21 16:02:21 +0900
committerKentaro Hayashi <hayashi@clear-code.com>2016-07-21 16:02:21 +0900
commit8f3fb2f7c8ecd993b432796902446e643689b513 (patch)
tree8849815cc449e4fbddace37e007b4ee5face95ac /sesman
parent9ccbfb698530966ad51574a8e7e56991f6ef94bd (diff)
downloadxrdp-proprietary-8f3fb2f7c8ecd993b432796902446e643689b513.tar.gz
xrdp-proprietary-8f3fb2f7c8ecd993b432796902446e643689b513.zip
chansrv: avoid chansrv SEGV when xinode is NULL
When xfuse_create_file_in_xrdp_fs is failed, it returns NULL. Without this fix, xinode->size causes SEGV, so implementation is changed to return -1 and check the return value in caller.
Diffstat (limited to 'sesman')
-rw-r--r--sesman/chansrv/chansrv_fuse.c5
-rw-r--r--sesman/chansrv/clipboard_file.c6
2 files changed, 10 insertions, 1 deletions
diff --git a/sesman/chansrv/chansrv_fuse.c b/sesman/chansrv/chansrv_fuse.c
index 0bb9ceff..80bde674 100644
--- a/sesman/chansrv/chansrv_fuse.c
+++ b/sesman/chansrv/chansrv_fuse.c
@@ -780,6 +780,11 @@ int xfuse_add_clip_dir_item(char *filename, int flags, int size, int lindex)
2, /* parent inode */
filename,
S_IFREG);
+ if (xinode == NULL)
+ {
+ log_debug("failed to create file in xrdp filesystem");
+ return -1;
+ }
xinode->size = size;
xinode->lindex = lindex;
xinode->is_loc_resource = 1;
diff --git a/sesman/chansrv/clipboard_file.c b/sesman/chansrv/clipboard_file.c
index 562ee82d..8c2f2189 100644
--- a/sesman/chansrv/clipboard_file.c
+++ b/sesman/chansrv/clipboard_file.c
@@ -660,7 +660,11 @@ clipboard_c2s_in_files(struct stream *s, char *file_list)
"supported [%s]", cfd->cFileName);
continue;
}
- xfuse_add_clip_dir_item(cfd->cFileName, 0, cfd->fileSizeLow, lindex);
+ if (xfuse_add_clip_dir_item(cfd->cFileName, 0, cfd->fileSizeLow, lindex) == -1)
+ {
+ log_error("clipboard_c2s_in_files: failed to add clip dir item");
+ continue;
+ }
if (file_count > 0)
{