client: Fix return value check for sb_received().
authorAndre Noll <maan@tuebingen.mpg.de>
Thu, 9 Oct 2014 00:33:06 +0000 (00:33 +0000)
committerAndre Noll <maan@tuebingen.mpg.de>
Sun, 18 Jan 2015 14:45:23 +0000 (15:45 +0100)
This bug can cause the client to segfault if it is fed invalid data.

client_common.c

index f615bb7..b47364c 100644 (file)
@@ -159,7 +159,10 @@ again:
        }
        if (n == 0)
                return 0;
-       if (!sb_received(ct->sbc[0], n, result))
+       ret = sb_received(ct->sbc[0], n, result);
+       if (ret < 0)
+               return ret;
+       if (ret == 0)
                goto again;
        ct->sbc[0] = NULL;
        return 1;