mirror of
https://git.tartarus.org/simon/putty.git
synced 2025-05-28 15:24:49 -05:00
Robert Evans spotted that bignum_decimal() failed to cope with being given
a zero input. This shouldn't matter for PuTTY, as these routines are only used in PuTTYgen, to output SSH-1 format public key exponents/moduli, which should be nonzero. [originally from svn r6731]
This commit is contained in:
parent
a3b6eac834
commit
d75ab2b509
7
sshbn.c
7
sshbn.c
@ -1037,9 +1037,14 @@ char *bignum_decimal(Bignum x)
|
||||
* round up (rounding down might make it less than x again).
|
||||
* Therefore if we multiply the bit count by 28/93, rounding
|
||||
* up, we will have enough digits.
|
||||
*
|
||||
* i=0 (i.e., x=0) is an irritating special case.
|
||||
*/
|
||||
i = bignum_bitcount(x);
|
||||
ndigits = (28 * i + 92) / 93; /* multiply by 28/93 and round up */
|
||||
if (!i)
|
||||
ndigits = 1; /* x = 0 */
|
||||
else
|
||||
ndigits = (28 * i + 92) / 93; /* multiply by 28/93 and round up */
|
||||
ndigits++; /* allow for trailing \0 */
|
||||
ret = snewn(ndigits, char);
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user