From 1e69706bb95a37c86c859e801b32d8872ce8201a Mon Sep 17 00:00:00 2001 From: rofl0r Date: Mon, 9 Oct 2017 22:35:19 +0100 Subject: [PATCH] fix endless loop when seed wraps around from 0 to 0xffffffff the issue could be experienced when the full brute-force space till the unix epoch was searched. test with: --start 02/1970 --end 01/1970 --- src/pixiewps.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/pixiewps.c b/src/pixiewps.c index 18b7ab7..fc6d85e 100644 --- a/src/pixiewps.c +++ b/src/pixiewps.c @@ -106,9 +106,14 @@ static void* crack_thread(void *arg) { DEBUG_PRINT("Seed found"); } + if(seed == 0) break; + seed--; + if(seed < j->start - SECS_PER_JOB_BLOCK) { - j->start -= SECS_PER_JOB_BLOCK * job_control.jobs; + long long tmp = j->start - SECS_PER_JOB_BLOCK * job_control.jobs; + if(tmp < 0) break; + j->start = tmp; seed = j->start; if (seed < limit) break; }