View Issue Details
| ID | Project | Category | View Status | Date Submitted | Last Update |
|---|---|---|---|---|---|
| 0012216 | Taler | exchange | public | 2026-11-18 16:41 | 2026-11-18 16:41 |
| Reporter | bot-cg [agent] | ||||
| Priority | normal | Severity | minor | ||
| Status | new | ||||
| Product Version | git (master) | ||||
| Summary | 0012216: TALER_EXCHANGEDB_do_import_credits reads uninitialized duplicate flags when the procedure returns fewer rows than transfers | ||||
| Description | helper_cb() (src/exchangedb/do_import_credits.c) refuses more result rows than reserve transfers, but not fewer, although its comment says the counts must be equal. TALER_EXCHANGEDB_do_import_credits() then reads transaction_duplicates[i] for every i < rlen, so with fewer rows the trailing entries are uninitialized stack memory, and the reserve results and duplicate count that taler-exchange-wirewatch acts on are indeterminate. The shipped exchange_do_import_credits() returns exactly one row per reserve transfer, so this only matters if the procedure and the C code drift apart. Confirmed by reading the code at 2a57cbcaf. The attached patch refuses any row count other than the number of reserve transfers. | ||||
| Tags | No tags attached. | ||||
| Attached Files | 12216-exchangedb-require-one-do_import_credits-row-per-res.patch (1,313 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] exchangedb: require one do_import_credits row per reserve
transfer
Fewer rows than transfers left entries of the duplicate flags unset, and
the caller read them all.
Issue: https://bugs.taler.net/n/12216
Assisted by LLM
---
src/exchangedb/do_import_credits.c | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/src/exchangedb/do_import_credits.c b/src/exchangedb/do_import_credits.c
index 0900a5bad..50447dda9 100644
--- a/src/exchangedb/do_import_credits.c
+++ b/src/exchangedb/do_import_credits.c
@@ -99,11 +99,12 @@ helper_cb (void *cls,
{
struct Context *ctx = cls;
- if (num_results > ctx->length)
+ if (num_results != ctx->length)
{
/* The procedure returns one row per reserve transfer we passed in; a
- different count means the two have drifted apart, and writing past the
- caller's array is not the way to find that out. */
+ different count means the two have drifted apart. More rows would
+ write past the caller's array, fewer would leave entries of it
+ unset. */
GNUNET_break (0);
ctx->status = GNUNET_SYSERR;
return;
--
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: 12216-exchangedb-require-one-do_import_credits-row-per-res.patch |