From 31c3759ecdee5db19a589640250a6deddbc93f06 Mon Sep 17 00:00:00 2001 From: Con Kolivas Date: Fri, 28 Sep 2012 10:37:42 +1000 Subject: [PATCH] Check return value of stratum_parse. --- util.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/util.c b/util.c index 54f795e9..0aeadf6a 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); }