[Spice-commits] server/red-stream.c

Frediano Ziglio fziglio at kemper.freedesktop.org
Thu Jan 4 20:09:34 UTC 2018


 server/red-stream.c |    2 ++
 1 file changed, 2 insertions(+)

New commits:
commit 736288299318bbaae0d12cb8de118c454f019758
Author: Frediano Ziglio <fziglio at redhat.com>
Date:   Tue Dec 12 17:20:39 2017 +0000

    red-stream: Avoid infinite loop on sasl_encode/decode failure
    
    These functions do not set errno so it is possible that errno has a
    stale value which happens to be EAGAIN.
    This would cause an infinite loop in functions like red_stream_write_all
    (or potentially using the event loop).
    
    Signed-off-by: Frediano Ziglio <fziglio at redhat.com>
    Acked-by: Christophe Fergeau <cfergeau at redhat.com>

diff --git a/server/red-stream.c b/server/red-stream.c
index a73eeb38..fccad8b2 100644
--- a/server/red-stream.c
+++ b/server/red-stream.c
@@ -596,6 +596,7 @@ static ssize_t red_stream_sasl_write(RedStream *s, const void *buf, size_t nbyte
                           &s->priv->sasl.encodedLength);
         if (err != SASL_OK) {
             spice_warning("sasl_encode error: %d", err);
+            errno = EIO;
             return -1;
         }
 
@@ -657,6 +658,7 @@ static ssize_t red_stream_sasl_read(RedStream *s, uint8_t *buf, size_t nbyte)
                       &decoded, &decodedlen);
     if (err != SASL_OK) {
         spice_warning("sasl_decode error: %d", err);
+        errno = EIO;
         return -1;
     }
 


More information about the Spice-commits mailing list