[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-changelog] [qemu-xen master] ui: correctly advance output buffer when writing SASL data



commit 88ab85384da431950d319ab69438891c29e4a5dd
Author:     Daniel P. Berrangé <berrange@xxxxxxxxxx>
AuthorDate: Thu Feb 1 15:58:41 2018 +0000
Commit:     Michael Roth <mdroth@xxxxxxxxxxxxxxxxxx>
CommitDate: Mon Feb 12 18:34:49 2018 -0600

    ui: correctly advance output buffer when writing SASL data
    
    In this previous commit:
    
      commit 8f61f1c5a6bc06438a1172efa80bc7606594fa07
      Author: Daniel P. Berrange <berrange@xxxxxxxxxx>
      Date:   Mon Dec 18 19:12:20 2017 +0000
    
        ui: track how much decoded data we consumed when doing SASL encoding
    
    I attempted to fix a flaw with tracking how much data had actually been
    processed when encoding with SASL. With that flaw, the VNC server could
    mistakenly discard queued data that had not been sent.
    
    The fix was not quite right though, because it merely decremented the
    vs->output.offset value. This is effectively discarding data from the
    end of the pending output buffer. We actually need to discard data from
    the start of the pending output buffer. We also want to free memory that
    is no longer required. The correct way to handle this is to use the
    buffer_advance() helper method instead of directly manipulating the
    offset value.
    
    Reported-by: Laszlo Ersek <lersek@xxxxxxxxxx>
    Signed-off-by: Daniel P. Berrangé <berrange@xxxxxxxxxx>
    Reviewed-by: Eric Blake <eblake@xxxxxxxxxx>
    Reviewed-by: Laszlo Ersek <lersek@xxxxxxxxxx>
    Message-id: 20180201155841.27509-1-berrange@xxxxxxxxxx
    Signed-off-by: Gerd Hoffmann <kraxel@xxxxxxxxxx>
    (cherry picked from commit 627ebec208a8809818589e17f4fce55a59420ad2)
    Signed-off-by: Michael Roth <mdroth@xxxxxxxxxxxxxxxxxx>
---
 ui/vnc-auth-sasl.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/ui/vnc-auth-sasl.c b/ui/vnc-auth-sasl.c
index 74a5f51..fbccca8 100644
--- a/ui/vnc-auth-sasl.c
+++ b/ui/vnc-auth-sasl.c
@@ -84,7 +84,7 @@ size_t vnc_client_write_sasl(VncState *vs)
         } else {
             vs->force_update_offset -= vs->sasl.encodedRawLength;
         }
-        vs->output.offset -= vs->sasl.encodedRawLength;
+        buffer_advance(&vs->output, vs->sasl.encodedRawLength);
         vs->sasl.encoded = NULL;
         vs->sasl.encodedOffset = vs->sasl.encodedLength = 0;
     }
--
generated by git-patchbot for /home/xen/git/qemu-xen.git#master

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxxx
https://lists.xenproject.org/xen-changelog

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.