Browse Source

Fix potential division by 0 if nfactor is not set

djm34
ystarnaud 11 years ago
parent
commit
72590bdcf2
  1. 4
      algorithm.c

4
algorithm.c

@ -667,7 +667,7 @@ void set_algorithm(algorithm_t* algo, const char* newname_alias) @@ -667,7 +667,7 @@ void set_algorithm(algorithm_t* algo, const char* newname_alias)
const char* newname;
//load previous algorithm nfactor in case nfactor was applied before algorithm... or default to 10
uint8_t old_nfactor = ((algo->nfactor)?algo->nfactor:0);
uint8_t nfactor = 0;
uint8_t nfactor = 10;
if (!(newname = lookup_algorithm_alias(newname_alias, &nfactor)))
newname = newname_alias;
@ -678,8 +678,6 @@ void set_algorithm(algorithm_t* algo, const char* newname_alias) @@ -678,8 +678,6 @@ void set_algorithm(algorithm_t* algo, const char* newname_alias)
if ((old_nfactor > 0) && (old_nfactor != nfactor))
nfactor = old_nfactor;
// Doesn't matter for non-scrypt algorithms
if (nfactor > 0)
set_algorithm_nfactor(algo, nfactor);
}

Loading…
Cancel
Save