From: Andre Noll <maan@tuebingen.mpg.de>
Date: Thu, 9 Oct 2014 00:33:06 +0000 (+0000)
Subject: client: Fix return value check for sb_received().
X-Git-Tag: v0.5.4~10
X-Git-Url: https://git.tue.mpg.de/?a=commitdiff_plain;h=66cfa4ab3cd509b1b7d1b5fb860fc4644a2313ab;p=paraslash.git

client: Fix return value check for sb_received().

This bug can cause the client to segfault if it is fed invalid data.
---

diff --git a/client_common.c b/client_common.c
index f615bb72..b47364c9 100644
--- a/client_common.c
+++ b/client_common.c
@@ -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;