From 78a894231ae8ec4959007b6d9b8d2a15d6333a1e Mon Sep 17 00:00:00 2001 From: Alan Coopersmith Date: Tue, 17 Mar 2009 15:42:19 -0700 Subject: [PATCH] When makekeys fails to find a good hash, print error instead of divide-by-zero Signed-off-by: Alan Coopersmith --- src/util/makekeys.c | 10 ++++++++++ 1 file changed, 10 insertions(+) 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++) {