X-Git-Url: https://git.distorted.org.uk/u/mdw/putty/blobdiff_plain/3d88e64dfcf5dc0fd361ce0c504c67a9196ce44c..1c63e24602c01c5d7e5587088969d90a25807386:/sshdh.c diff --git a/sshdh.c b/sshdh.c index 27d5aab5..af7eaf82 100644 --- a/sshdh.c +++ b/sshdh.c @@ -123,7 +123,7 @@ Bignum dh_create_e(void *handle, int nbits) ssh1_write_bignum(buf, ctx->qmask); for (i = 2; i < nbytes; i++) buf[i] &= random_byte(); - ssh1_read_bignum(buf, &ctx->x); + ssh1_read_bignum(buf, nbytes, &ctx->x); /* can't fail */ } else { int b, nb; ctx->x = bn_power_2(nbits); @@ -140,6 +140,8 @@ Bignum dh_create_e(void *handle, int nbits) } } while (bignum_cmp(ctx->x, One) <= 0 || bignum_cmp(ctx->x, ctx->q) >= 0); + sfree(buf); + /* * Done. Now compute e = g^x mod p. */