summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlan Coopersmith <alan.coopersmith@sun.com>2009-03-17 15:42:19 -0700
committerAlan Coopersmith <alan.coopersmith@sun.com>2009-03-17 15:42:19 -0700
commit78a894231ae8ec4959007b6d9b8d2a15d6333a1e (patch)
treee9e8935d5cccaa7a34629bfe2fb1a7ba472697a9
parentc9f84af591d15fbc3fa890bcd955d94f1ff82a0b (diff)
When makekeys fails to find a good hash, print error instead of divide-by-zero
Signed-off-by: Alan Coopersmith <alan.coopersmith@sun.com>
-rw-r--r--src/util/makekeys.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/util/makekeys.c b/src/util/makekeys.c
index 72736a1f..20266f18 100644
--- a/src/util/makekeys.c
+++ b/src/util/makekeys.c
@@ -154,6 +154,11 @@ next1: ;
}
z = best_z;
+ if (z == 0) {
+ fprintf(stderr, "makekeys: failed to find small enough hash!\n"
+ "Try increasing KTNUM in makekeys.c\n");
+ exit(1);
+ }
printf("#ifdef NEEDKTABLE\n");
printf("const unsigned char _XkeyTable[] = {\n");
printf("0,\n");
@@ -234,6 +239,11 @@ next2: ;
}
z = best_z;
+ if (z == 0) {
+ fprintf(stderr, "makekeys: failed to find small enough hash!\n"
+ "Try increasing KTNUM in makekeys.c\n");
+ exit(1);
+ }
for (i = z; --i >= 0;)
offsets[i] = 0;
for (i = 0; i < ksnum; i++) {