Commit 31c3759ecdee5db19a589640250a6deddbc93f06

Con Kolivas 2012-09-28T10:37:42

Check return value of stratum_parse.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
diff --git a/util.c b/util.c
index 54f795e..0aeadf6 100644
--- a/util.c
+++ b/util.c
@@ -1116,7 +1116,12 @@ bool auth_stratum(struct pool *pool)
 	/* Parse all data prior sending auth request */
 	while (sock_full(pool->sock, false)) {
 		sret = recv_line(pool->sock);
-		parse_stratum(pool, sret);
+		if (!parse_stratum(pool, sret)) {
+			clear_sock(pool->sock);
+			applog(LOG_WARNING, "Failed to parse stratum buffer");
+			free(sret);
+			return ret;
+		}
 		free(sret);
 	}