Re: [PATCH spice] server: don't assert on invalid client message

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

 



On 06/25/2014 03:36 PM, Marc-André Lureau wrote:
Some users have been reaching this error:
snd_receive: ASSERT n failed

A misbehaving client could easily hit that condition by sending too big
messages. Instead of assert(), replace with a warning. When a message
too big to fit is received, it will simply disconnect the channel.

https://bugzilla.redhat.com/show_bug.cgi?id=962187
---
  server/snd_worker.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/server/snd_worker.c b/server/snd_worker.c
index 7d52ded..70148b7 100644
--- a/server/snd_worker.c
+++ b/server/snd_worker.c
@@ -421,7 +421,7 @@ static void snd_receive(void* data)
      for (;;) {
          ssize_t n;
          n = channel->receive_data.end - channel->receive_data.now;
-        spice_assert(n);
+        spice_warn_if(n <= 0);
          n = reds_stream_read(channel->stream, channel->receive_data.now, n);
          if (n <= 0) {
              if (n == 0) {

Ack.

If n is 0, it will disconnect the channel and return, in following lines not shown here. If n < 0 (if possible), there is going to be a problem (signed->unsigned). But that problem already exists
in the current code too.

_______________________________________________
Spice-devel mailing list
Spice-devel@xxxxxxxxxxxxxxxxxxxxx
http://lists.freedesktop.org/mailman/listinfo/spice-devel





[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]     [Monitors]