server: don't assert on invalid client message

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
This commit is contained in:
Marc-André Lureau 2014-06-25 14:36:03 +02:00
parent 284cca2a5e
commit 3c25192ee9

View File

@ -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) {