View Issue Details
| ID | Project | Category | View Status | Date Submitted | Last Update |
|---|---|---|---|---|---|
| 0012218 | Taler | exchange | public | 2026-11-18 16:41 | 2026-11-18 16:45 |
| Reporter | bot-cg [agent] | ||||
| Implementer | oec | Reviewer | Christian Grothoff | ||
| Release signed by | Christian Grothoff | Deployed by | Christian Grothoff | ||
| Verifier | oec | Communicator | CM_7 | ||
| Priority | normal | Severity | minor | ||
| Status | closed | Resolution | fixed | ||
| Product Version | git (master) | ||||
| Target Version | 1.6 | Fixed in Version | 1.6 | ||
| Summary | 0012218: POST /aml/$OFFICER_PUB/decision sizes a stack array by the number of events in the request | ||||
| Description | The decision handler (taler-exchange-httpd_post-aml-OFFICER_PUB-decision.c) declares const char *sevents[num_events] on the stack, with num_events = json_array_size() of the request's "events", which nothing bounds. A request body may be up to TALER_MHD_REQUEST_BUFFER_MAX (16 MiB); at about four bytes per event that is some four million entries, 32 MiB of stack. The request has to come from an AML officer with write access. Confirmed by reading the code at 2a57cbcaf. The attached patch allocates the array on the heap and frees it at the handler's common exit. | ||||
| Tags | No tags attached. | ||||
| Attached Files | 12218-exchange-keep-AML-decision-events-off-the-stack.patch (1,822 bytes)
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Christian Grothoff <christian@grothoff.org>
Date: Wed, 18 Nov 2026 17:41:26 +0100
Subject: [PATCH] exchange: keep AML decision events off the stack
The number of events comes from the request, which may be up to 16 MiB.
Issue: https://bugs.taler.net/n/12218
Assisted by LLM
---
.../taler-exchange-httpd_post-aml-OFFICER_PUB-decision.c | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/src/exchange/taler-exchange-httpd_post-aml-OFFICER_PUB-decision.c b/src/exchange/taler-exchange-httpd_post-aml-OFFICER_PUB-decision.c
index ed461c3bd..e07fabae0 100644
--- a/src/exchange/taler-exchange-httpd_post-aml-OFFICER_PUB-decision.c
+++ b/src/exchange/taler-exchange-httpd_post-aml-OFFICER_PUB-decision.c
@@ -237,6 +237,8 @@ TEH_handler_post_aml_decision (
bool is_wallet;
size_t eas = 0;
void *ea = NULL;
+ /* on the heap: the request decides how many events there are */
+ const char **sevents = NULL;
if (NULL == adc)
{
@@ -364,7 +366,6 @@ TEH_handler_post_aml_decision (
{
size_t num_events = json_array_size (events);
- const char *sevents[GNUNET_NZL (num_events)];
enum GNUNET_DB_QueryStatus qs;
struct GNUNET_TIME_Timestamp last_date;
bool invalid_officer = true;
@@ -384,6 +385,8 @@ TEH_handler_post_aml_decision (
&eas);
}
+ sevents = GNUNET_new_array (GNUNET_NZL (num_events),
+ const char *);
for (size_t i = 0; i<num_events; i++)
{
sevents[i] = json_string_value (json_array_get (events,
@@ -537,6 +540,7 @@ TEH_handler_post_aml_decision (
done:
TALER_KYCLOGIC_rules_free (lrs);
GNUNET_free (ea);
+ GNUNET_free (sevents);
return ret;
}
--
2.47.3
| ||||
| child of | 0012186 | new | Unchecked array lengths and counts in exchange, merchant and anastasis: review after 2a57cbcaf [meta] |
| Date Modified | Username | Field | Change |
|---|---|---|---|
| 2026-11-18 16:41 | bot-cg | New Issue | |
| 2026-11-18 16:41 | bot-cg | Relationship added | child of 0012186 |
| 2026-11-18 16:41 | bot-cg | Implementer | => oec |
| 2026-11-18 16:41 | bot-cg | Reviewer | => Christian Grothoff |
| 2026-11-18 16:41 | bot-cg | Release signed by | => Christian Grothoff |
| 2026-11-18 16:41 | bot-cg | Deployed by | => Christian Grothoff |
| 2026-11-18 16:41 | bot-cg | Verifier | => oec |
| 2026-11-18 16:41 | bot-cg | Communicator | => CM_7 |
| 2026-11-18 16:41 | bot-cg | File Added: 12218-exchange-keep-AML-decision-events-off-the-stack.patch | |
| 2026-11-18 16:45 | Christian Grothoff | Status | new => closed |
| 2026-11-18 16:45 | Christian Grothoff | Resolution | open => fixed |
| 2026-11-18 16:45 | Christian Grothoff | Note Added: 0030606 | |
| 2026-11-18 16:45 | Christian Grothoff | Fixed in Version | => 1.6 |
| 2026-11-18 16:45 | Christian Grothoff | Target Version | => 1.6 |