Commit d962d202a00688cf6f895488f9ac250e1d9455be

Con Kolivas 2014-01-04T11:35:20

Sanity check in hfa_get_header

1
2
3
4
5
6
7
8
9
10
11
12
13
diff --git a/driver-hashfast.c b/driver-hashfast.c
index 6a92203..9da4569 100644
--- a/driver-hashfast.c
+++ b/driver-hashfast.c
@@ -181,7 +181,7 @@ static bool hfa_get_header(struct cgpu_info *hashfast, struct hf_header *h, uint
 		header = memchr(buf, HF_PREAMBLE, ofs);
 		if (header)
 			len -= ofs - (header - buf);
-	} while (len);
+	} while (len > 0);
 
 	memcpy(h, header, orig_len);
 	*computed_crc = hfa_crc8((uint8_t *)h);