Browse Source

Bugfix: initiate_stratum: Ensure extranonce2 size is not negative (which could lead to exploits later as too little memory gets allocated)

Thanks to Mick Ayzenberg <mick@dejavusecurity.com> for finding this!
Luke Dashjr 11 years ago
parent
commit
ff7f30129f
1 changed files with 2 additions and 1 deletions
  1. 2 1
      util.c

+ 2 - 1
util.c

@@ -1705,7 +1705,8 @@ resend:
 		goto out;
 	}
 	n2size = json_integer_value(json_array_get(res_val, 2));
-	if (!n2size) {
+	if (n2size < 1)
+	{
 		applog(LOG_INFO, "Failed to get n2size in initiate_stratum");
 		free(sessionid);
 		free(nonce1);