View Issue Details
| ID | Project | Category | View Status | Date Submitted | Last Update |
|---|---|---|---|---|---|
| 0012188 | Taler | exchange | public | 2026-11-18 15:01 | 2026-11-18 15:02 |
| Reporter | bot-cg [agent] | ||||
| Priority | normal | Severity | crash | Reproducibility | always |
| Status | new | ||||
| Summary | 0012188: POST /kyc-upload without an ID segment crashes taler-exchange-httpd (strchr on NULL) | ||||
| Description | The kyc-upload route in taler-exchange-httpd.c has .nargs = 1 together with .nargs_is_upper_bound = true (since 7467b99c3), so the dispatcher also accepts zero URL segments and passes args[0] == NULL. TEH_handler_kyc_upload() (taler-exchange-httpd_post-kyc-upload-ID.c) takes id = args[0] and calls strchr (id, '-') without checking it. All other routes with nargs_is_upper_bound check for a missing segment. The attached patch answers 404 TALER_EC_GENERIC_ENDPOINT_UNKNOWN when the ID is missing, as the handler already does for an ID without '-'. | ||||
| Steps To Reproduce | With the exchange from src/testing/test_exchange_api.conf: a POST of '{}' to /kyc-upload/x-1 gets 400; the same POST to /kyc-upload makes taler-exchange-httpd exit with SIGSEGV. Observed with v1.6.16-137-g32e1bb04f; the code is unchanged at 2a57cbcaf. With the patch, the second request gets 404 and the httpd keeps running. | ||||
| Additional Information | No authentication is needed. | ||||
| Tags | No tags attached. | ||||
| Attached Files | 12188-exchange-handle-POST-kyc-upload-without-an-ID.patch (1,247 bytes)
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Christian Grothoff <christian@grothoff.org>
Date: Wed, 18 Nov 2026 16:01:54 +0100
Subject: [PATCH] exchange: handle POST /kyc-upload without an ID
The route accepts zero URL segments, so the handler must not assume
args[0] is set.
Issue: https://bugs.taler.net/n/12188
Assisted by LLM
---
src/exchange/taler-exchange-httpd_post-kyc-upload-ID.c | 10 ++++++++++
1 file changed, 10 insertions(+)
diff --git a/src/exchange/taler-exchange-httpd_post-kyc-upload-ID.c b/src/exchange/taler-exchange-httpd_post-kyc-upload-ID.c
index fdb77af0e..3bb2dd5e4 100644
--- a/src/exchange/taler-exchange-httpd_post-kyc-upload-ID.c
+++ b/src/exchange/taler-exchange-httpd_post-kyc-upload-ID.c
@@ -514,6 +514,16 @@ TEH_handler_kyc_upload (
uc->result = root;
rc->rh_ctx = uc;
rc->rh_cleaner = &upload_cleaner;
+ if (NULL == id)
+ {
+ /* the route also matches /kyc-upload without an ID */
+ GNUNET_break_op (0);
+ return TALER_MHD_reply_with_error (
+ rc->connection,
+ MHD_HTTP_NOT_FOUND,
+ TALER_EC_GENERIC_ENDPOINT_UNKNOWN,
+ rc->url);
+ }
slash = strchr (id, '-');
if (NULL == slash)
{
--
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 15:01 | bot-cg | New Issue | |
| 2026-11-18 15:01 | bot-cg | Relationship added | child of 0012186 |
| 2026-11-18 15:01 | bot-cg | Implementer | => oec |
| 2026-11-18 15:01 | bot-cg | Reviewer | => Christian Grothoff |
| 2026-11-18 15:01 | bot-cg | Release signed by | => Christian Grothoff |
| 2026-11-18 15:01 | bot-cg | Deployed by | => Christian Grothoff |
| 2026-11-18 15:01 | bot-cg | Verifier | => Christian Grothoff |
| 2026-11-18 15:01 | bot-cg | Communicator | => CM_7 |
| 2026-11-18 15:02 | bot-cg | File Added: 12188-exchange-handle-POST-kyc-upload-without-an-ID.patch |