From 86a701d3af323dcffe17b07e772e6be77c561dd8 Mon Sep 17 00:00:00 2001 From: Keuin Date: Sun, 29 May 2022 01:17:03 +0800 Subject: Bugfix: stack out-of-range access when printing non-terminated string with printf. --- main.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/main.c b/main.c index 0f8d294..b6aa680 100644 --- a/main.c +++ b/main.c @@ -245,7 +245,9 @@ int thread_worker(thread_param *param) { * So we mask out the LSBs from md5_hex before comparing */ if (ctx.yield == ((*(uint64_t *) md5_hex) & 0xFEFEFEFEFEFEFEFEull)) { atomic_store(&key_found, true); - printf("[+] FOUND KEY: %s\n", md5_hex); + printf("[+] FOUND KEY: "); + fwrite(md5_hex, 1, sizeof(md5_hex), stdout); + putchar('\n'); crack_result.plaintext = plaintext; crack_result.len = unpadded_length; return 0; -- cgit v1.2.3