Browse Source

Fail in proxy mode if the nonce2 length is too small to successfully proxy

master
Con Kolivas 11 years ago
parent
commit
860abc7903
  1. 8
      src/generator.c

8
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); LOGWARNING("Invalid nonce2len %d in parse_subscribe", size);
goto out; goto out;
} }
if (size < 4) {
LOGWARNING("Nonce2 length %d too small to be able to proxy", size);
goto out;
}
proxi->nonce2len = size; 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); proxi->nonce2len);
ret = true; ret = true;
@ -630,7 +634,7 @@ static bool auth_stratum(connsock_t *cs, proxy_instance_t *proxi)
LOGWARNING("Failed to authorise in auth_stratum"); LOGWARNING("Failed to authorise in auth_stratum");
goto out; goto out;
} }
LOGINFO("Auth success in auth_stratum!"); LOGINFO("Auth success in auth_stratum");
out: out:
if (val) if (val)
json_decref(val); json_decref(val);

Loading…
Cancel
Save