diff --git a/src/modules/Gmp/next_prime.c b/src/modules/Gmp/next_prime.c
index 533138882913a1c3059f6f7d4fea18fd3aef6d12..7e126f2e664de32c7180691665c494f379b448f1 100644
--- a/src/modules/Gmp/next_prime.c
+++ b/src/modules/Gmp/next_prime.c
@@ -1,4 +1,4 @@
-/* $Id: next_prime.c,v 1.8 1998/07/11 16:24:00 grubba Exp $
+/* $Id: next_prime.c,v 1.9 1999/03/11 16:01:09 nisse Exp $
  *
  * Prime number test using trial division for small primes and then
  * Miller-Rabin, as suggested in Schneier's Applied Cryptography.
@@ -9,7 +9,7 @@
 
 #include "global.h"
 
-RCSID("$Id: next_prime.c,v 1.8 1998/07/11 16:24:00 grubba Exp $");
+RCSID("$Id: next_prime.c,v 1.9 1999/03/11 16:01:09 nisse Exp $");
 
 #include "gmp_machine.h"
 
@@ -177,7 +177,7 @@ mpz_next_prime(mpz_t p, mpz_t n, int count, int prime_limit)
   if (prime_limit)
     {
       /* Compute residues modulo small odd primes */
-      moduli = (unsigned long*) alloca((prime_limit -1) * sizeof(*moduli));
+      moduli = (unsigned long*) alloca(prime_limit * sizeof(*moduli));
       for (i = 0; i < prime_limit; i++)
 	moduli[i] = mpz_fdiv_ui(p, primes[i + 1]);
     }