From 8091b77c7ce363b4116d2e73aa6db15e8aee1b2a Mon Sep 17 00:00:00 2001 From: Con Kolivas Date: Fri, 13 Mar 2015 22:46:41 +1100 Subject: [PATCH] Allow arbitrary length responses from ckdb in send_recv_auth to allow for hundreds of workers --- src/stratifier.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/stratifier.c b/src/stratifier.c index 2f38a53d..33dafa07 100644 --- a/src/stratifier.c +++ b/src/stratifier.c @@ -2390,13 +2390,16 @@ static int send_recv_auth(stratum_instance_t *client) free(json_msg); if (likely(buf)) { + char *cmd = NULL, *secondaryuserid = NULL, *response; worker_instance_t *worker = client->worker_instance; - char *cmd = NULL, *secondaryuserid = NULL; - char response[PAGESIZE] = {}; json_error_t err_val; + size_t responselen; json_t *val = NULL; LOGINFO("Got ckdb response: %s", buf); + responselen = strlen(buf); /* Leave ample room for response based on buf length */ + response = alloca(responselen); + memset(response, 0, responselen); if (unlikely(sscanf(buf, "id.%*d.%s", response) < 1 || strlen(response) < 1 || !strchr(response, '='))) { if (cmdmatch(response, "failed")) goto out;