summaryrefslogtreecommitdiffstats
path: root/sesman/chansrv/clipboard_file.c
diff options
context:
space:
mode:
Diffstat (limited to 'sesman/chansrv/clipboard_file.c')
-rw-r--r--sesman/chansrv/clipboard_file.c28
1 files changed, 20 insertions, 8 deletions
diff --git a/sesman/chansrv/clipboard_file.c b/sesman/chansrv/clipboard_file.c
index 54a7b46a..42b5d4a3 100644
--- a/sesman/chansrv/clipboard_file.c
+++ b/sesman/chansrv/clipboard_file.c
@@ -53,7 +53,7 @@ extern int g_cliprdr_chan_id; /* in chansrv.c */
extern struct clip_s2c g_clip_s2c; /* in clipboard.c */
extern struct clip_c2s g_clip_c2s; /* in clipboard.c */
-extern char g_fuse_root_path[]; /* in chansrv_fuse.c */
+extern char g_fuse_clipboard_path[];
struct cb_file_info
{
@@ -454,7 +454,9 @@ clipboard_request_file_data(int stream_id, int lindex, int offset,
int size;
int rv;
- LLOGLN(10, ("clipboard_request_file_data:"));
+ LLOGLN(10, ("clipboard_request_file_data: stream_id=%d lindex=%d off=%d request_bytes=%d",
+ stream_id, lindex, offset, request_bytes));
+
if (g_file_request_sent_type != 0)
{
LLOGLN(0, ("clipboard_request_file_data: warning, still waiting "
@@ -534,13 +536,13 @@ clipboard_process_file_response(struct stream *s, int clip_msg_status,
in_uint32_le(s, file_size);
LLOGLN(10, ("clipboard_process_file_response: streamId %d "
"file_size %d", streamId, file_size));
- fuse_file_contents_size(streamId, file_size);
+ xfuse_file_contents_size(streamId, file_size);
}
else if (g_file_request_sent_type == CB_FILECONTENTS_RANGE)
{
g_file_request_sent_type = 0;
in_uint32_le(s, streamId);
- fuse_file_contents_range(streamId, s->p, clip_msg_len - 4);
+ xfuse_file_contents_range(streamId, s->p, clip_msg_len - 4);
}
else
{
@@ -593,8 +595,18 @@ clipboard_c2s_in_files(struct stream *s, char *file_list)
struct clip_file_desc *cfd;
char *ptr;
+ if (!s_check_rem(s, 4))
+ {
+ LLOGLN(0, ("clipboard_c2s_in_files: parse error"));
+ return 1;
+ }
in_uint32_le(s, cItems);
- fuse_clear_clip_dir();
+ if (cItems > 64 * 1024) /* sanity check */
+ {
+ LLOGLN(0, ("clipboard_c2s_in_files: error cItems %d too big", cItems));
+ return 1;
+ }
+ xfuse_clear_clip_dir();
LLOGLN(10, ("clipboard_c2s_in_files: cItems %d", cItems));
cfd = (struct clip_file_desc *)
g_malloc(sizeof(struct clip_file_desc), 0);
@@ -610,13 +622,13 @@ clipboard_c2s_in_files(struct stream *s, char *file_list)
"supported [%s]", cfd->cFileName));
continue;
}
- fuse_add_clip_dir_item(cfd->cFileName, 0, cfd->fileSizeLow, lindex);
+ xfuse_add_clip_dir_item(cfd->cFileName, 0, cfd->fileSizeLow, lindex);
g_strcpy(ptr, "file://");
ptr += 7;
- str_len = g_strlen(g_fuse_root_path);
- g_strcpy(ptr, g_fuse_root_path);
+ str_len = g_strlen(g_fuse_clipboard_path);
+ g_strcpy(ptr, g_fuse_clipboard_path);
ptr += str_len;
*ptr = '/';