[Spice-commits] vdagent/file_xfer.cpp

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Mon May 25 14:31:14 UTC 2020


 vdagent/file_xfer.cpp |    4 ++++
 1 file changed, 4 insertions(+)

New commits:
commit 2d6bcd91819d83a63713e47b4c6dc1a0490037d1
Author: Frediano Ziglio <fziglio at redhat.com>
Date:   Wed Mar 18 20:55:23 2020 +0000

    file_xfer: Return detailed error for invalid filename
    
    A literal constant is used for error type as the project is not
    dependent on glib2 and that Visual Studio and CMake are supported
    so it would make the compilation on some environment more complicated
    than actually is just for a constant.
    
    Signed-off-by: Frediano Ziglio <fziglio at redhat.com>
    Acked-by: Kevin Pouget <kpouget at redhat.com>
    Acked-by: Victor Toso <victortoso at redhat.com>

diff --git a/vdagent/file_xfer.cpp b/vdagent/file_xfer.cpp
index eb53c46..a530011 100644
--- a/vdagent/file_xfer.cpp
+++ b/vdagent/file_xfer.cpp
@@ -97,6 +97,10 @@ void FileXfer::handle_start(VDAgentFileXferStartMessage* start,
     }
     vd_printf("%u %s (%" PRIu64 ")", start->id, file_name, file_size);
     if (strcspn(file_name, FILENAME_RESERVED_CHAR_LIST) != strlen(file_name)) {
+        status.common.result = VD_AGENT_FILE_XFER_STATUS_ERROR;
+        status.error.error_type = VD_AGENT_FILE_XFER_STATUS_ERROR_GLIB_IO;
+        status.error.error_code = 10; // G_IO_ERROR_INVALID_FILENAME
+        status_size = sizeof(status.common) + sizeof(status.error);
         vd_printf("filename contains invalid characters");
         return;
     }


More information about the Spice-commits mailing list