git: 20bdc89bffd9 - main - primes: respect the precalculated primes table boundary
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Tue, 20 May 2025 04:31:15 UTC
The branch main has been updated by maxim: URL: https://cgit.FreeBSD.org/src/commit/?id=20bdc89bffd9daa1909f4b006ce68099c92bfda7 commit 20bdc89bffd9daa1909f4b006ce68099c92bfda7 Author: Maxim Konovalov <maxim@FreeBSD.org> AuthorDate: 2025-05-20 04:16:19 +0000 Commit: Maxim Konovalov <maxim@FreeBSD.org> CommitDate: 2025-05-20 04:29:49 +0000 primes: respect the precalculated primes table boundary PR: 285658 --- usr.bin/primes/primes.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/usr.bin/primes/primes.c b/usr.bin/primes/primes.c index d556a19a1553..7ad7d44d408c 100644 --- a/usr.bin/primes/primes.c +++ b/usr.bin/primes/primes.c @@ -289,6 +289,9 @@ primes(ubig start, ubig stop) for ( ; q < tab_lim; q += factor) { *q = '\0'; /* sieve out a spot */ } + if (p > pr_limit) { + break; + } factor = *p++; } while (factor <= fact_lim);