When makekeys fails to find a good hash, print error instead of divide-by-zero

Signed-off-by: Alan Coopersmith <alan.coopersmith@sun.com>
This commit is contained in:
Alan Coopersmith 2009-03-17 15:42:19 -07:00
parent c9f84af591
commit 78a894231a

View file

@ -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++) {