From 2c4ad7727514000e57761545fcb5e1d90e242f03 Mon Sep 17 00:00:00 2001 From: Jens Steube Date: Fri, 29 Jan 2016 22:47:42 +0100 Subject: [PATCH] Some systems don't like using the same buffer for both input and output at the same time with snprintf() --- src/oclHashcat.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/oclHashcat.c b/src/oclHashcat.c index ea5ef21ed..c8def8447 100644 --- a/src/oclHashcat.c +++ b/src/oclHashcat.c @@ -13629,16 +13629,18 @@ int main (int argc, char **argv) device_param->program = hc_clCreateProgramWithSource (data.ocl, device_param->context, 1, (const char **) kernel_sources, NULL); + char build_opts_update[1024] = { 0 }; + if (force_jit_compilation == 1500) { - snprintf (build_opts, sizeof (build_opts) - 1, "%s -DDESCRYPT_SALT=%d", build_opts, data.salts_buf[0].salt_buf[0]); + snprintf (build_opts_update, sizeof (build_opts_update) - 1, "%s -DDESCRYPT_SALT=%d", build_opts, data.salts_buf[0].salt_buf[0]); } else if (force_jit_compilation == 8900) { - snprintf (build_opts, sizeof (build_opts) - 1, "%s -DSCRYPT_N=%d -DSCRYPT_R=%d -DSCRYPT_P=%d -DSCRYPT_TMTO=%d", build_opts, data.salts_buf[0].scrypt_N, data.salts_buf[0].scrypt_r, data.salts_buf[0].scrypt_p, 1 << data.salts_buf[0].scrypt_tmto); + snprintf (build_opts_update, sizeof (build_opts_update) - 1, "%s -DSCRYPT_N=%d -DSCRYPT_R=%d -DSCRYPT_P=%d -DSCRYPT_TMTO=%d", build_opts, data.salts_buf[0].scrypt_N, data.salts_buf[0].scrypt_r, data.salts_buf[0].scrypt_p, 1 << data.salts_buf[0].scrypt_tmto); } - hc_clBuildProgram (data.ocl, device_param->program, 1, &device_param->device, build_opts, NULL, NULL); + hc_clBuildProgram (data.ocl, device_param->program, 1, &device_param->device, build_opts_update, NULL, NULL); } local_free (kernel_lengths);