diff --git a/src/formats.c b/src/formats.c index d55377c..b90b43f 100644 --- a/src/formats.c +++ b/src/formats.c @@ -13,6 +13,7 @@ #ifndef BENCH_BUILD #include "options.h" #endif +#include "memory.h" struct fmt_main *fmt_list = NULL; static struct fmt_main **fmt_tail = &fmt_list; @@ -61,6 +62,7 @@ char *fmt_self_test(struct fmt_main *format) char *ciphertext, *plaintext; int ntests, done, index, max, size; void *binary, *salt; + char *null; if (format->params.plaintext_length > PLAINTEXT_BUFFER_SIZE - 3) return "length"; @@ -76,6 +78,9 @@ char *fmt_self_test(struct fmt_main *format) current = format->params.tests; if (ntests==0) return NULL; + null = mem_calloc_tiny(format->params.plaintext_length + 1, + MEM_ALIGN_WORD); + done = 0; index = 0; max = format->params.max_keys_per_crypt; do { @@ -128,7 +133,7 @@ char *fmt_self_test(struct fmt_main *format) /* Remove some old keys to better test cmp_all() */ if (index & 1) - format->methods.set_key("", index); + format->methods.set_key(null, index); /* 0 1 2 3 4 6 9 13 19 28 42 63 94 141 211 316 474 711 1066 ... */ if (index >= 2 && max > ntests)