summaryrefslogtreecommitdiff
path: root/sexp2bignum.c
diff options
context:
space:
mode:
authorNiels Möller <nisse@lysator.liu.se>2002-11-16 00:23:04 +0100
committerNiels Möller <nisse@lysator.liu.se>2002-11-16 00:23:04 +0100
commit093e19c07e1812f8dcd52eb4b18f48ab85778a69 (patch)
tree0be8c490df4765eedd8e4451e79c503d3efca6e4 /sexp2bignum.c
parent136c422d93036597164b8eb86bc3319061438aa2 (diff)
downloadnettle-093e19c07e1812f8dcd52eb4b18f48ab85778a69.tar.gz
(nettle_mpz_set_sexp): In the first check against
limit, added some margin to allow for sign octets. Rev: src/nettle/sexp2bignum.c:1.3
Diffstat (limited to 'sexp2bignum.c')
-rw-r--r--sexp2bignum.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/sexp2bignum.c b/sexp2bignum.c
index 69757cee..f7ef6884 100644
--- a/sexp2bignum.c
+++ b/sexp2bignum.c
@@ -38,10 +38,12 @@ nettle_mpz_set_sexp(mpz_t x, unsigned limit, const struct sexp_iterator *i)
&& i->atom_length
&& !i->display)
{
- if (limit && (8 * i->atom_length > limit))
+ /* Allow some extra here, for leading sign octets. */
+ if (limit && (8 * i->atom_length > (16 + limit)))
return 0;
nettle_mpz_set_str_256_s(x, i->atom_length, i->atom);
+ /* FIXME: How to interpret a limit for negative numbers? */
return !limit || mpz_sizeinbase(x, 2) <= limit;
}
else