[Spice-commits] 2 commits - server/common-graphics-channel.c server/inputs-channel-client.c

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Wed Mar 4 09:11:40 UTC 2020


 server/common-graphics-channel.c |    5 +++--
 server/inputs-channel-client.c   |    5 +++--
 2 files changed, 6 insertions(+), 4 deletions(-)

New commits:
commit c5127b9d0e2ffa9114271e11099b30602f27420f
Author: Frediano Ziglio <fziglio at redhat.com>
Date:   Wed Mar 4 09:03:53 2020 +0000

    common-graphics-channel: Use sizeof instead of size constant
    
    Minimal style change.
    Allows to easier change the size of the buffer.
    
    Signed-off-by: Frediano Ziglio <fziglio at redhat.com>
    Acked-by: Francesco Giudici <fgiudici at redhat.com>

diff --git a/server/common-graphics-channel.c b/server/common-graphics-channel.c
index cea805d0..3871c720 100644
--- a/server/common-graphics-channel.c
+++ b/server/common-graphics-channel.c
@@ -52,8 +52,9 @@ static uint8_t *common_alloc_recv_buf(RedChannelClient *rcc, uint16_t type, uint
         return g_malloc(size);
     }
 
-    if (size > CHANNEL_RECEIVE_BUF_SIZE) {
-        spice_warning("unexpected message size %u (max is %d)", size, CHANNEL_RECEIVE_BUF_SIZE);
+    if (size > sizeof(common->priv->recv_buf)) {
+        spice_warning("unexpected message size %u (max is %zd)", size,
+                      sizeof(common->priv->recv_buf));
         return NULL;
     }
     return common->priv->recv_buf;
commit 7230ff3d47e13b761d25bdde95fed9480b5c0914
Author: Frediano Ziglio <fziglio at redhat.com>
Date:   Wed Mar 4 07:33:11 2020 +0000

    inputs-channel-client: Use sizeof instead of size constant
    
    Minimal style change.
    Allows to easier change the size of the buffer.
    
    Signed-off-by: Frediano Ziglio <fziglio at redhat.com>
    Acked-by: Francesco Giudici <fgiudici at redhat.com>

diff --git a/server/inputs-channel-client.c b/server/inputs-channel-client.c
index 99c3751c..c6329dcc 100644
--- a/server/inputs-channel-client.c
+++ b/server/inputs-channel-client.c
@@ -43,13 +43,14 @@ static uint8_t *
 inputs_channel_client_alloc_msg_rcv_buf(RedChannelClient *rcc,
                                         uint16_t type, uint32_t size)
 {
-    if (size > RECEIVE_BUF_SIZE) {
+    InputsChannelClient *icc = INPUTS_CHANNEL_CLIENT(rcc);
+
+    if (size > sizeof(icc->priv->recv_buf)) {
         red_channel_warning(red_channel_client_get_channel(rcc),
                             "error: too large incoming message");
         return NULL;
     }
 
-    InputsChannelClient *icc = INPUTS_CHANNEL_CLIENT(rcc);
     return icc->priv->recv_buf;
 }
 


More information about the Spice-commits mailing list