View Issue Details

IDProjectCategoryView StatusLast Update
0012212Talersyncpublic2026-11-18 16:42
Reporterbot-cg [agent]  
Implementeravalos  
PrioritynormalSeverityminor 
Status implementing 
Product Versiongit (master) 
Summary0012212: sync client: a block list that fails to parse half-way is handed out with its full length and zero-filled entries
Descriptionhandle_block_list_finished() (src/lib/sync_api_block_list.c) sets num_entries to json_array_size() of the reply and allocates the entries zeroed. When SYNC_block_entry_parse() fails at index idx it only sets ec and stops, so the callback still gets the full num_entries with entries idx and later all zeros. A caller that does not check ec on a 200 uses them as blocks: the block-delete test command walks every entry, treats a zero entry (whose all-zero nonces look like the 'no neighbour' marker) as the previous block, and signs a relink over it with the account key.

Confirmed by reading the code at 9f3dac2.

The attached patch releases the entries parsed so far and hands out an empty list with TALER_EC_GENERIC_REPLY_MALFORMED.
Additional InformationRecorded as SYNC-056 in sync's review notes; the patch is that review's 0051 (in 303a031 on dev/bots/review), unchanged.
TagsNo tags attached.
Attached Files
12212-sync-do-not-report-a-partially-parsed-block-list.patch (1,327 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] sync: do not report a partially parsed block list

After a parse failure the list kept its full length with zero-filled
entries, which callers treated as real blocks.

Issue: https://bugs.taler.net/n/12212

Assisted by LLM
---
 src/lib/sync_api_block_list.c | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/src/lib/sync_api_block_list.c b/src/lib/sync_api_block_list.c
index 6219024..b0d5b89 100644
--- a/src/lib/sync_api_block_list.c
+++ b/src/lib/sync_api_block_list.c
@@ -112,8 +112,15 @@ handle_block_list_finished (void *cls,
             SYNC_block_entry_parse (entry,
                                     e))
         {
+          /* do not hand the caller a partially parsed list with
+             zero-filled entries */
           GNUNET_break_op (0);
-          ld.ec = TALER_EC_GENERIC_PARAMETER_MALFORMED;
+          ld.ec = TALER_EC_GENERIC_REPLY_MALFORMED;
+          for (unsigned int i = 0; i < idx; i++)
+            SYNC_block_entry_clear (&ld.entries[i]);
+          GNUNET_free (ld.entries);
+          ld.entries = NULL;
+          ld.num_entries = 0;
           break;
         }
       }
-- 
2.47.3

Required notifications

Address or linkRemarkAdded byNotifiedActions

Relationships

child of 0012186 new Unchecked array lengths and counts in exchange, merchant and anastasis: review after 2a57cbcaf [meta] 

Activities

Issue History

Date ModifiedUsernameFieldChange
2026-11-18 16:41bot-cgNew Issue
2026-11-18 16:41bot-cgRelationship addedchild of 0012186
2026-11-18 16:41bot-cgImplementer => avalos
2026-11-18 16:41bot-cgRelease signed by => Florian Dold
2026-11-18 16:41bot-cgDeployed by => avalos
2026-11-18 16:41bot-cgVerifier => avalos
2026-11-18 16:41bot-cgCommunicator => CM_7
2026-11-18 16:41bot-cgFile Added: 12212-sync-do-not-report-a-partially-parsed-block-list.patch
2026-11-18 16:42Christian GrothoffStatusnew => implementing