>From c7d360b8c2a8b5436ecbf805b099ee6c5d5e4352 Mon Sep 17 00:00:00 2001 From: magnum Date: Thu, 28 Jun 2012 01:18:45 +0200 Subject: [PATCH] Fix for fake_salts.c that regains 52MB of BSS --- src/fake_salts.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/fake_salts.c b/src/fake_salts.c index 9105b7f..77c6388 100644 --- a/src/fake_salts.c +++ b/src/fake_salts.c @@ -26,10 +26,14 @@ void build_fake_salts_for_regen_lost(struct db_salt *salts) { if (options.regen_lost_salts == 1) // this is for PHPS, with a raw 32 byte hash input file (i.e. missing the salts) { - static struct db_salt *sp, fake_salts[('~'-' '+1)*('~'-' '+1)*('~'-' '+1)+1]; + static struct db_salt *sp, *fake_salts; int i, j, k, idx=0; char *buf, *cp; unsigned long *ptr; + + if (!fake_salts) + fake_salts = mem_calloc_tiny(sizeof(struct db_salt) * (('~'-' '+1)*('~'-' '+1)*('~'-' '+1)+1), MEM_ALIGN_WORD); + // Find the 'real' salt. We loaded ALL of the file into 1 salt. // we then take THAT salt record, and build a list pointing to these fake salts, // AND build 'proper' dynamic salts for all of our data. @@ -65,10 +69,14 @@ void build_fake_salts_for_regen_lost(struct db_salt *salts) { } else if (options.regen_lost_salts == 2) // this is for osCommerce, with a raw 32 byte hash input file (i.e. missing the salts) { - static struct db_salt *sp, fake_salts[('~'-' '+1)*('~'-' '+1)+1]; + static struct db_salt *sp, *fake_salts; int i, j, idx=0; char *buf, *cp; unsigned long *ptr; + + if (!fake_salts) + fake_salts = mem_calloc_tiny(sizeof(struct db_salt) * (('~'-' '+1)*('~'-' '+1)+1), MEM_ALIGN_WORD); + // Find the 'real' salt. We loaded ALL of the file into 1 salt. // we then take THAT salt record, and build a list pointing to these fake salts, // AND build 'proper' dynamic salts for all of our data. -- 1.7.9.5