From 860abc7903105437cf58a158cb26cded45d47ca7 Mon Sep 17 00:00:00 2001 From: Con Kolivas Date: Sat, 17 May 2014 19:53:11 +1000 Subject: [PATCH] Fail in proxy mode if the nonce2 length is too small to successfully proxy --- src/generator.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/generator.c b/src/generator.c index f31b5da3..07213570 100644 --- a/src/generator.c +++ b/src/generator.c @@ -365,9 +365,13 @@ static bool parse_subscribe(connsock_t *cs, proxy_instance_t *proxi) LOGWARNING("Invalid nonce2len %d in parse_subscribe", size); goto out; } + if (size < 4) { + LOGWARNING("Nonce2 length %d too small to be able to proxy", size); + goto out; + } proxi->nonce2len = size; - LOGINFO("Found notify with enonce %s nonce2len %d !", proxi->enonce1, + LOGINFO("Found notify with enonce %s nonce2len %d", proxi->enonce1, proxi->nonce2len); ret = true; @@ -630,7 +634,7 @@ static bool auth_stratum(connsock_t *cs, proxy_instance_t *proxi) LOGWARNING("Failed to authorise in auth_stratum"); goto out; } - LOGINFO("Auth success in auth_stratum!"); + LOGINFO("Auth success in auth_stratum"); out: if (val) json_decref(val);