>From e788be3899323747977a71824baec5260fdb7af2 Mon Sep 17 00:00:00 2001 From: magnum Date: Tue, 17 Jan 2012 14:25:22 +0100 Subject: [PATCH 2/4] Test: Deliberately use misaligned ciphertext in self test --- src/formats.c | 8 ++++++-- 1 files changed, 6 insertions(+), 2 deletions(-) diff --git a/src/formats.c b/src/formats.c index 31e5f3f..a90a77a 100644 --- a/src/formats.c +++ b/src/formats.c @@ -64,7 +64,7 @@ static char *fmt_self_test_body(struct fmt_main *format, { static char s_size[32]; struct fmt_tests *current; - char *ciphertext, *plaintext; + char *ciphertext = NULL, *plaintext; int ntests, done, index, max, size; void *binary, *salt; @@ -92,7 +92,11 @@ static char *fmt_self_test_body(struct fmt_main *format, return "prepare"; if (format->methods.valid(prepared,format) != 1) return "valid"; - ciphertext = format->methods.split(prepared, 0); + /* Ensure we have a misaligned ciphertext */ + if (!ciphertext) + ciphertext = mem_alloc_tiny(LINE_BUFFER_SIZE + 1, + MEM_ALIGN_WORD) + 1; + strcpy(ciphertext, format->methods.split(prepared, 0)); plaintext = current->plaintext; /* -- 1.7.5.4