[Spice-devel] [PATCH vd_agent_linux 09/10] vdagentd: do not allow to use an already used file-xfer id

Frediano Ziglio fziglio at redhat.com
Tue Nov 3 09:48:33 UTC 2020


From: Uri Lublin <uril at redhat.com>

Signed-off-by: Uri Lublin <uril at redhat.com>
Acked-by: Frediano Ziglio <fziglio at redhat.com>
---
 src/vdagentd/vdagentd.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/src/vdagentd/vdagentd.c b/src/vdagentd/vdagentd.c
index 8437779..78378aa 100644
--- a/src/vdagentd/vdagentd.c
+++ b/src/vdagentd/vdagentd.c
@@ -404,6 +404,13 @@ static void do_client_file_xfer(VirtioPort *vport,
                "Cancelling client file-xfer request %u",
                s->id, VD_AGENT_FILE_XFER_STATUS_ERROR, (void*) &error, detail_size);
             return;
+        } else if (g_hash_table_lookup(active_xfers, GUINT_TO_POINTER(s->id)) != NULL) {
+            // id is already used -- client is confused
+            send_file_xfer_status(vport,
+               "File transfer ID is already used. "
+               "Cancelling client file-xfer request %u",
+               s->id, VD_AGENT_FILE_XFER_STATUS_ERROR, NULL, 0);
+            return;
         }
         msg_type = VDAGENTD_FILE_XFER_START;
         id = s->id;
-- 
2.26.2



More information about the Spice-devel mailing list