exchange

Base system with REST service to issue digital coins, run by the payment service provider
Log | Files | Refs | Submodules | README | LICENSE

commit 79ed71113369b014987489f21c36449945fbc753
parent 186c80a743fd0196d9476db59a1dd34a056a01ba
Author: Christian Grothoff <grothoff@gnunet.org>
Date:   Wed, 15 Jul 2026 18:17:02 +0200

stricter bounds checks

Diffstat:
Msrc/exchangedb/select_recoup_above_serial_id.c | 2++
Msrc/lib/exchange_api_stefan.c | 2++
Msrc/mhd/mhd2_responses.c | 2+-
Msrc/util/crypto_helper_cs.c | 18++++++++++++++++++
Msrc/util/crypto_helper_esign.c | 12++++++++++++
Msrc/util/crypto_helper_rsa.c | 12++++++++++++
6 files changed, 47 insertions(+), 1 deletion(-)

diff --git a/src/exchangedb/select_recoup_above_serial_id.c b/src/exchangedb/select_recoup_above_serial_id.c @@ -150,6 +150,8 @@ TALER_EXCHANGEDB_select_recoup_above_serial_id ( }; enum GNUNET_DB_QueryStatus qs; + /* FIXME-9828: this query joins with table/columns + that no longer exist... */ PREPARE (pg, "recoup_get_incr", "SELECT" diff --git a/src/lib/exchange_api_stefan.c b/src/lib/exchange_api_stefan.c @@ -324,4 +324,6 @@ TALER_EXCHANGE_keys_stefan_round ( val->fraction -= mod; /* round down */ else val->fraction += frac - mod; /* round up */ + GNUNET_assert (GNUNET_SYSERR != + TALER_amount_normalize (val)); } diff --git a/src/mhd/mhd2_responses.c b/src/mhd/mhd2_responses.c @@ -371,7 +371,7 @@ TALER_MHD2_reply_agpl (struct MHD_Request *request, MHD_response_add_header (response, MHD_HTTP_HEADER_CONTENT_TYPE, "text/plain")); - if (MHD_SC_OK == + if (MHD_SC_OK != MHD_response_add_header (response, MHD_HTTP_HEADER_LOCATION, url)) diff --git a/src/util/crypto_helper_cs.c b/src/util/crypto_helper_cs.c @@ -341,6 +341,12 @@ more: if (off < sizeof (struct GNUNET_MessageHeader)) continue; msize = ntohs (hdr->size); + if (msize < sizeof (struct GNUNET_MessageHeader)) + { + GNUNET_break_op (0); + do_disconnect (dh); + return; + } if (off < msize) continue; GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, @@ -555,6 +561,12 @@ more: if (off < sizeof (struct GNUNET_MessageHeader)) continue; msize = ntohs (hdr->size); + if (msize < sizeof (struct GNUNET_MessageHeader)) + { + GNUNET_break_op (0); + do_disconnect (dh); + return TALER_EC_EXCHANGE_DENOMINATION_HELPER_BUG; + } if (off < msize) continue; switch (ntohs (hdr->type)) @@ -805,6 +817,12 @@ more: if (off < sizeof (struct GNUNET_MessageHeader)) continue; msize = ntohs (hdr->size); + if (msize < sizeof (struct GNUNET_MessageHeader)) + { + GNUNET_break_op (0); + do_disconnect (dh); + return TALER_EC_EXCHANGE_DENOMINATION_HELPER_BUG; + } if (off < msize) continue; switch (ntohs (hdr->type)) diff --git a/src/util/crypto_helper_esign.c b/src/util/crypto_helper_esign.c @@ -293,6 +293,12 @@ more: if (off < sizeof (struct GNUNET_MessageHeader)) continue; msize = ntohs (hdr->size); + if (msize < sizeof (struct GNUNET_MessageHeader)) + { + GNUNET_break_op (0); + do_disconnect (esh); + return; + } if (off < msize) continue; switch (ntohs (hdr->type)) @@ -429,6 +435,12 @@ more: if (off < sizeof (struct GNUNET_MessageHeader)) continue; msize = ntohs (hdr->size); + if (msize < sizeof (struct GNUNET_MessageHeader)) + { + GNUNET_break_op (0); + do_disconnect (esh); + return TALER_EC_EXCHANGE_SIGNKEY_HELPER_BUG; + } if (off < msize) continue; switch (ntohs (hdr->type)) diff --git a/src/util/crypto_helper_rsa.c b/src/util/crypto_helper_rsa.c @@ -350,6 +350,12 @@ more: if (off < sizeof (struct GNUNET_MessageHeader)) continue; msize = ntohs (hdr->size); + if (msize < sizeof (struct GNUNET_MessageHeader)) + { + GNUNET_break_op (0); + do_disconnect (dh); + return; + } if (off < msize) continue; GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, @@ -536,6 +542,12 @@ more: if (off < sizeof (struct GNUNET_MessageHeader)) continue; msize = ntohs (hdr->size); + if (msize < sizeof (struct GNUNET_MessageHeader)) + { + GNUNET_break_op (0); + do_disconnect (dh); + return TALER_EC_EXCHANGE_DENOMINATION_HELPER_BUG; + } if (off < msize) continue; switch (ntohs (hdr->type))