X-Git-Url: https://asedeno.scripts.mit.edu/gitweb/?a=blobdiff_plain;f=sshdh.c;h=af7eaf8207f591041bdeeabf983a72a158890009;hb=4c31b113a6deb4894b640e4989ae9ef1f8063c0e;hp=27d5aab58c9b40930c0098e54763ff63d0008ed1;hpb=d36a4c3685f17057ba2c80ac471c1284b615469f;p=PuTTY.git 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. */