summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKaz Kylheku <kaz@kylheku.com>2025-05-07 12:12:25 -0700
committerKaz Kylheku <kaz@kylheku.com>2025-05-07 12:12:25 -0700
commit50e958f5be982bff900a81ab55b34757921b3b31 (patch)
treead3fd95048db817f879a7f659a63a20497cc6bc8
parent0c91e2e16cb6f6aadfce44e8c8c50387a8e465c0 (diff)
downloadtxr-50e958f5be982bff900a81ab55b34757921b3b31.tar.gz
txr-50e958f5be982bff900a81ab55b34757921b3b31.tar.bz2
txr-50e958f5be982bff900a81ab55b34757921b3b31.zip
mpi: allow conversion of zero-sized buffer.
This causes assertions in uint-buf and int-buf on an empty buffer argument. * mpi.c (mp_read_unsigned_bin): Remove len > 0 assertion, because the code works fine for len == 0, returning the zero mp_int produced by mp_zero.
-rw-r--r--mpi/mpi.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/mpi/mpi.c b/mpi/mpi.c
index 5aa3d06f..3b01b6f9 100644
--- a/mpi/mpi.c
+++ b/mpi/mpi.c
@@ -2545,7 +2545,7 @@ mp_err mp_read_unsigned_bin(mp_int *mp, unsigned char *str, size_t len)
mp_size ix;
mp_err res;
- ARGCHK(mp != NULL && str != NULL && len > 0, MP_BADARG);
+ ARGCHK(mp != NULL && str != NULL, MP_BADARG);
mp_zero(mp);